home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 / Aminet - June 1993 [Walnut Creek].iso / usenet / sources / volume90 / unix / uucp103d / part04 < prev    next >
Encoding:
Internet Message Format  |  1990-02-04  |  61.7 KB

  1. Path: xanth!cs.odu.edu!Amiga-Request
  2. From: Amiga-Request@cs.odu.edu (Amiga Sources/Binaries Moderator)
  3. Newsgroups: comp.sources.amiga
  4. Subject: v90i048: uucp 1.03D - unix compatible uucp/mail/news system, Part04/16
  5. Message-ID: <11287@xanth.cs.odu.edu>
  6. Date: 4 Feb 90 02:31:41 GMT
  7. Sender: tadguy@cs.odu.edu
  8. Reply-To: overload!dillon (Matt Dillon)
  9. Lines: 2701
  10. Approved: tadguy@cs.odu.edu (Tad Guy)
  11. X-Mail-Submissions-To: Amiga@cs.odu.edu
  12.  
  13. Submitted-by: overload!dillon (Matt Dillon)
  14. Posting-number: Volume 90, Issue 048
  15. Archive-name: unix/uucp-1.03d/part04
  16.  
  17. #!/bin/sh
  18. # This is a shell archive.  Remove anything before this line, then unpack
  19. # it by saving it into a file and typing "sh file".  To overwrite existing
  20. # files, type "sh file -c".  You can also feed this as standard input via
  21. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  22. # will see the following message at the end:
  23. #        "End of archive 4 (of 16)."
  24. # Contents:  Disk1.contents Problems.DOC man/Grep src/GUtil/gnote.c
  25. #   src/GUtil/uuserdump.c src/News060/postnews.c
  26. #   src/compress/tarsplit.c src/compress/uudecode.c
  27. #   src/dmail/do_lists.c src/lib/alias.c src/sendmail/domain.c
  28. #   src/uucico/modem.c src/uucico/uucp.c src/uucico/uux.c
  29. # Wrapped by tadguy@xanth on Sat Feb  3 20:51:05 1990
  30. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  31. if test -f 'Disk1.contents' -a "${1}" != "-c" ; then 
  32.   echo shar: Will not clobber existing file \"'Disk1.contents'\"
  33. else
  34. echo shar: Extracting \"'Disk1.contents'\" \(3887 characters\)
  35. sed "s/^X//" >'Disk1.contents' <<'END_OF_FILE'
  36. X
  37. XArchive ../uucp1.03D.zoo.1:
  38. XLength    CF  Size Now  Date      Time
  39. X--------  --- --------  --------- --------
  40. X     908  28%      656  28 Nov 88 10:11:14     uucp0/l/null-handler
  41. X    5204  32%     3540  25 Jan 90 14:31:56     uucp0/l/uuser-handler
  42. X     118  19%       96   7 Jan 90 21:49:46     uucp0/l/.DistFiles
  43. X    1379  38%      860  15 Oct 89 17:25:22     uucp0/s/.edrc
  44. X       9   0%        9   3 Nov 89 15:59:20     uucp0/s/.DistFiles
  45. X     872  28%      626  14 Jan 90 19:58:06     uucp0/s/startup-sequence
  46. X     471  20%      375   8 Jan 90 19:52:58     uucp0/s/crontab
  47. X      32   0%       32   7 Jan 90 21:51:14     uucp0/libs/.DistFiles
  48. X      30   0%       30   7 Jan 90 21:48:14     uucp0/devs/.DistFiles
  49. X     185  25%      138  29 Oct 89 15:17:58     uucp0/devs/Mountlist
  50. X      71   8%       65  10 Jan 90 12:14:48     uucp0/lib/NewsGroups
  51. X       3   0%        3  10 Jan 90 12:28:48     uucp0/lib/SeqNews
  52. X      99   0%       99   7 Jan 90 21:35:58     uucp0/lib/Getty-header
  53. X     987  34%      656   8 Jan 90 18:23:54     uucp0/lib/Domain
  54. X     369  25%      278   5 Jan 90 14:06:32     uucp0/lib/Security
  55. X     600  21%      477   8 Jan 90 18:33:52     uucp0/lib/Passwd
  56. X     497  37%      315   8 Jan 90 18:38:54     uucp0/lib/L.Sys
  57. X     255  24%      194   8 Jan 90 19:03:00     uucp0/lib/Config
  58. X     164  19%      133  14 Oct 89 15:36:20     uucp0/lib/news.distribution
  59. X     167  13%      145   8 Jan 90 21:33:42     uucp0/lib/.signature
  60. X    1027  32%      694   8 Jan 90 22:20:12     uucp0/lib/.dmailrc
  61. X    1273  29%      900  14 Jan 90 19:16:04     uucp0/lib/Aliases
  62. X       4   0%        4  25 Jan 90 12:45:38     uucp0/lib/seq
  63. X       0   0%        0  25 Jan 90 23:03:10     uucp0/mail/news/zoo-dummy
  64. X       0   0%        0  25 Jan 90 23:03:10     uucp0/mail/zoo-dummy
  65. X       0   0%        0  25 Jan 90 23:03:10     uucp0/spool/zoo-dummy
  66. X       0   0%        0  25 Jan 90 23:03:10     uucp0/pub/zoo-dummy
  67. X   23648  51%    11528  25 Jan 90 23:03:14     uucp0/man/dmail.help
  68. X    3727  42%     2155  24 Jan 90 20:15:56     uucp0/Problems.DOC
  69. X   14853  49%     7635  14 Jan 90 20:58:48     uucp0/SlowSetup.DOC
  70. X     755  29%      537  12 Jan 90 12:40:16     uucp0/NewsSetup.DOC
  71. X    2213  59%      909  10 Jan 90 19:32:04     uucp0/MakeDist
  72. X    5830  42%     3390  25 Jan 90 16:34:14     uucp0/QuickSetup.DOC
  73. X    7968  47%     4240  25 Jan 90 23:01:34     uucp0/README.NOW
  74. X    1265  29%      892  25 Jan 90 22:47:10     uucp0/VERSION.DOC
  75. X   58896  26%    43360  25 Jan 90 17:09:12     uucp0/c/dme
  76. X   11292  21%     8930  18 Oct 89 23:17:54     uucp0/c/dcron
  77. X   44864  28%    32107  25 Jan 90 14:20:44     uucp0/c/uucico
  78. X    9328  22%     7232  25 Jan 90 14:22:46     uucp0/c/uupoll
  79. X    7316  22%     5709  25 Jan 90 14:24:16     uucp0/c/uuname
  80. X   11976  22%     9318  25 Jan 90 14:23:50     uucp0/c/gnote
  81. X   12684  23%     9783  25 Jan 90 14:25:54     uucp0/c/expandm
  82. X    8840  23%     6817  25 Jan 90 14:26:22     uucp0/c/trimfile
  83. X   14144  25%    10656  25 Jan 90 14:21:54     uucp0/c/uuxqt
  84. X   13932  24%    10591  25 Jan 90 14:23:54     uucp0/c/uux
  85. X   14028  24%    10691  25 Jan 90 14:09:40     uucp0/c/uucp
  86. X   27592  25%    20767  25 Jan 90 14:30:24     uucp0/c/rmail
  87. X   19684  26%    14478  25 Jan 90 13:57:46     uucp0/c/rnews
  88. X   17820  26%    13146  25 Jan 90 13:58:18     uucp0/c/PostNews
  89. X   18408  25%    13751  25 Jan 90 14:28:02     uucp0/c/getty
  90. X   47948  31%    33291  14 Jan 90 19:20:04     uucp0/c/dmail
  91. X   27592  25%    20767  25 Jan 90 14:30:22     uucp0/c/sendmail
  92. X   24760  27%    17952  10 Jan 90 18:48:56     uucp0/c/anews
  93. X      43   2%       42   8 Jan 90 19:21:04     uucp0/c/.DistFiles
  94. X     240  10%      215   2 Jan 90 21:45:42     uucp0/c/auxscript
  95. X    7352  23%     5647  25 Jan 90 14:21:40     uucp0/c/uuserdump
  96. X   26904  31%    18627   5 Feb 89 15:02:34     uucp0/c/dmake
  97. X--------  --- --------  --------- --------
  98. X  500626  29%   355488    57 files
  99. END_OF_FILE
  100. if test 3887 -ne `wc -c <'Disk1.contents'`; then
  101.     echo shar: \"'Disk1.contents'\" unpacked with wrong size!
  102. fi
  103. # end of 'Disk1.contents'
  104. fi
  105. if test -f 'Problems.DOC' -a "${1}" != "-c" ; then 
  106.   echo shar: Will not clobber existing file \"'Problems.DOC'\"
  107. else
  108. echo shar: Extracting \"'Problems.DOC'\" \(3727 characters\)
  109. sed "s/^X//" >'Problems.DOC' <<'END_OF_FILE'
  110. X
  111. X
  112. X                PROBLEMS.DOC
  113. X
  114. X                Matthew Dillon
  115. X                891 Regal Rd.
  116. X                Berkeley, Ca. 94708
  117. X
  118. X                pacbell.PacBell.COM!sorinc!overload!dillon
  119. X
  120. X
  121. X              MODEM AND GETTY
  122. X
  123. X    There are several possible sources of problems in setting up
  124. X    UUCP.  The major problem areas in order of likelyhood are
  125. X    listed below:
  126. X
  127. X    (1) The modem is expecting a protocol that Getty has not
  128. X    been told to use (XON/XOFF, 7WIRE, none)
  129. X
  130. X    If the modem uses 7-wire use the -7 option for Getty, else it is
  131. X    assumed the modem uses no protocol.  Normally you specify -7 but
  132. X    the modem will probably work just fine whether you specify it or
  133. X    not.
  134. X
  135. X    (2) The modem does not hangup when DTR is dropped
  136. X
  137. X    All modern modems hangup when DTR is dropped.  Usually a dip switch
  138. X    enables the option.  If it is impossible to drop a connection by
  139. X    dropping DTR you can use the -d0 option to make Getty use the +++
  140. X    sequence.  This only works if you do not specify a dumb modem in
  141. X    the -M option.
  142. X
  143. X    (3) The modem does not understand simple AT commands or does
  144. X    not generate a CONNECT message.
  145. X
  146. X    If the modem does understand dropping DTR but does not understand
  147. X    simple AT commands or generate a CONNECT message use -c0 -Md (no
  148. X    connect msg and dumb modem). In this case the baud rate must be
  149. X    known and specified with one or more -B options.  When no CONNECT
  150. X    message is available Getty does not know what the connect baud rate
  151. X    actually is.  It will begin by trying the first -B option and
  152. X    switch to the next whenever a line-break is received.
  153. X
  154. X    (4) Baud rate problems
  155. X
  156. X    The default modem type when no -M option is specified for Getty is
  157. X    a hays modem.  If you have a multimodem you can use -Mm and the
  158. X    baud adjust options for Getty.    Normally you specify a -B option
  159. X    for each baud rate the modem is capable of connecting at.  If the
  160. X    modem generates a CONNECT message you need only specify one -B
  161. X    option that is used to reset the modem and Getty will automatically
  162. X    handle the CONNECT messages.
  163. X
  164. X    If your modem always talks to your Amiga at a given baud rate no
  165. X    matter what the CONNECT message says then use a single -B option to
  166. X    specify that baud rate then the -A option which tells getty to
  167. X    ignore any baud rate specified in the CONNECT message.
  168. X
  169. X
  170. X               OUTGOING CALLS
  171. X
  172. X    Unfortunately Getty handles only incomming calls.  UUCico deals without
  173. X    outgoing calls itself.  Currently you must specify the proper baud rate
  174. X    in the L.Sys file for uucico to work properly. UUCico currently ignores
  175. X    any connect message.
  176. X
  177. X    Disconnecting will work the same way Getty handles it.  If there is no
  178. X    Getty running disconnecting works by dropping DTR.
  179. X
  180. X
  181. X                NEWS
  182. X
  183. X    RNews currently takes a large amount of memory (the 16 bit uncompress).
  184. X    At the moment there is no real solution to this problem.  If you
  185. X    run out of memory you may be left with queue files that did not
  186. X    get uuxqt'd due to uuxqt being unable to run rnews.
  187. X
  188. X
  189. X                 MAIL ADDRESSES
  190. X
  191. X    If you have problems queuing mail check your L.sys file.  Try emailing
  192. X    to the adjacent node directly. E.G. if you can connect to 'foo' try
  193. X    emailing a test message to 'foo!postmaster'.  If you do not wind
  194. X    up with three queue files in UUSPOOL: then your L.sys file
  195. X    probably has no entry for foo.  Whenever you email to somebody three
  196. X    files should end up being added to UUSPOOL: and whenever you UUCico
  197. X    to a given machine the spool files in question should be deleted as
  198. X    they are sent.  When UUCico receives mail from the remote machine it
  199. X    will download the remote queue files to UUSPOOL: then uuxqt them.
  200. X    That is, the remote queue files should will be placed temporarily in
  201. X    UUSPOOL:, unpacked with rmail and placed in UUMAIL:, then deleted.
  202. X
  203. X
  204. END_OF_FILE
  205. if test 3727 -ne `wc -c <'Problems.DOC'`; then
  206.     echo shar: \"'Problems.DOC'\" unpacked with wrong size!
  207. fi
  208. # end of 'Problems.DOC'
  209. fi
  210. if test -f 'man/Grep' -a "${1}" != "-c" ; then 
  211.   echo shar: Will not clobber existing file \"'man/Grep'\"
  212. else
  213. echo shar: Extracting \"'man/Grep'\" \(3569 characters\)
  214. sed "s/^X//" >'man/Grep' <<'END_OF_FILE'
  215. X
  216. XNAME
  217. X     grep, - search file for regular expression
  218. X
  219. XSYNTAX
  220. X     grep [option...] expression [file...]
  221. X
  222. XDESCRIPTION
  223. X     The grep command searchs the input files (standard input
  224. X     default) for lines matching a pattern.  Normally, each
  225. X     line found is copied to the standard output.  The grep com-
  226. X     mand patterns are limited regular expressions in the style
  227. X     of ex(1), which uses a compact nondeterministic algorithm.
  228. X
  229. X     In all cases the file name is shown if there is more than
  230. X     one input file.  Care should be taken when using the charac-
  231. X     ters $ * [ ^ | ( ) and \ in the expression as they are also
  232. X     meaningful to some Shells. It is safest to enclose the
  233. X     entire expression argument in single quotes ' '.
  234. X
  235. X          A \ followed by a single character other than new line
  236. X          matches that character.
  237. X
  238. X          The character ^ matches the beginning of a line.
  239. X
  240. X          The character $ matches the end of a line.
  241. X
  242. X          A . (period) matches any character.
  243. X
  244. X          A single character not otherwise endowed with special
  245. X          meaning matches that character.
  246. X
  247. X          A string enclosed in brackets [] matches any single
  248. X          character from the string.  Ranges of ASCII character
  249. X          codes may be abbreviated as in `a-z0-9'.  A ] may occur
  250. X          only as the first character of the string.  A literal -
  251. X          must be placed where it can't be mistaken as a range
  252. X          indicator.
  253. X
  254. X          A regular expression followed by an * (asterisk)
  255. X          matches a sequence of 0 or more matches of the regular
  256. X          expression.  A regular expression followed by a +
  257. X          (plus) matches a sequence of 1 or more matches of the
  258. X          regular expression.  A regular expression followed by a
  259. X          ? (question mark) matches a sequence of 0 or 1 matches
  260. X          of the regular expression.
  261. X
  262. X          Two regular expressions concatenated match a match of
  263. X          the first followed by a match of the second.
  264. X
  265. X          Two regular expressions separated by | or new line
  266. X          match either a match for the first or a match for the
  267. X          second.
  268. X
  269. X          A regular expression enclosed in parentheses matches a
  270. X          match for the regular expression.
  271. X
  272. X     The order of precedence of operators at the same parenthesis
  273. X     level is [] then *+? then concatenation then | and new line.
  274. X
  275. X     Ideally there should be only one grep, but we don't know a
  276. X     single algorithm that spans a wide enough range of space-
  277. X     time tradeoffs.
  278. X
  279. XOPTIONS
  280. X     -b Precedes each output line with its block number.  This is
  281. X        sometimes useful in locating disk block numbers by con-
  282. X        text.
  283. X
  284. X     -c Produces count of matching lines only.
  285. X
  286. X     -e expression
  287. X        Uses next argument as expression that begins with a minus
  288. X        (-).
  289. X
  290. X     -i Considers upper and lowercase letter identical in making
  291. X        comparisons.
  292. X
  293. X     -l Lists files with matching lines only once, separated by a
  294. X        new line.
  295. X
  296. X     -n Precedes each matching line with its line number.
  297. X
  298. X     -s Silent mode and nothing is printed (except error mes-
  299. X        sages).  This is useful for checking the error status
  300. X
  301. X     -v Displays all lines that do not match specified expres-
  302. X        sion.
  303. X
  304. X     -w Searches for an expression as for a word (as if sur-
  305. X        rounded by `\<' and `\>').
  306. X
  307. XRESTRICTIONS
  308. X     Lines are limited to 256 characters; longer lines are trun-
  309. X     cated.
  310. X
  311. XDIAGNOSTICS
  312. X     Exit status is 0 if any matches are found, 1 if none, 2 for
  313. X     syntax errors or inaccessible files.
  314. X
  315. END_OF_FILE
  316. if test 3569 -ne `wc -c <'man/Grep'`; then
  317.     echo shar: \"'man/Grep'\" unpacked with wrong size!
  318. fi
  319. # end of 'man/Grep'
  320. fi
  321. if test -f 'src/GUtil/gnote.c' -a "${1}" != "-c" ; then 
  322.   echo shar: Will not clobber existing file \"'src/GUtil/gnote.c'\"
  323. else
  324. echo shar: Extracting \"'src/GUtil/gnote.c'\" \(3220 characters\)
  325. sed "s/^X//" >'src/GUtil/gnote.c' <<'END_OF_FILE'
  326. X
  327. X/*
  328. X *  GNOTE.C
  329. X *
  330. X *  (C) Copyright 1989-1990 by Matthew Dillon,  All Rights Reserved.
  331. X *
  332. X *  GNOTE hellofile notefile
  333. X *
  334. X *  Allow the user to enter a note and append it to notefile.  See
  335. X *  Getty. Password entry should have a '*' in front of the executable
  336. X *  name for Getty to provide automatic stdin/stdout
  337. X *
  338. X */
  339. X
  340. X#include <proto/all.h>
  341. X#include <stdio.h>
  342. X#include <time.h>
  343. X#include "/version.h"
  344. X
  345. XIDENT(".00");
  346. X
  347. Xchar *GetLine();
  348. Xvoid PutDaChar();
  349. Xvoid FlushChars();
  350. X
  351. Xvoid
  352. Xmain(ac, av)
  353. Xchar *av[];
  354. X{
  355. X    time_t t;
  356. X    char *ptr;
  357. X    FILE *fi;
  358. X
  359. X    time(&t);
  360. X
  361. X    if (ac < 3) {
  362. X    printf("gnote: expect 2 arguments, got %d\n", ac - 1);
  363. X    fflush(stdout);
  364. X    Delay(50*2);
  365. X    exit(1);
  366. X    }
  367. X    printf("%s %s", Ident, ctime(&t));
  368. X    if (fi = fopen(av[1], "r")) {
  369. X    char buf[128];
  370. X    while (fgets(buf, sizeof(buf), fi))
  371. X        fputs(buf, stdout);
  372. X    fclose(fi);
  373. X    }
  374. X    fflush(stdout);
  375. X
  376. X    if ((fi = fopen(av[2], "a")) == NULL) {
  377. X    puts("couldn't open note file");
  378. X    fflush(stdout);
  379. X    Delay(50*2);
  380. X    exit(1);
  381. X    }
  382. X    fprintf(fi, "**NOTE** %s", ctime(&t));
  383. X
  384. X    while (ptr = GetLine()) {
  385. X    if (strcmp(ptr, ".") == 0)
  386. X        break;
  387. X    if (strncmp(ptr, "**NOTE**", 8) == 0)
  388. X        fprintf(fi, " ");
  389. X    fprintf(fi, "%s\n", ptr);
  390. X    }
  391. X    puts("Thank you, hanging up in 5 seconds");
  392. X    fflush(stdout);
  393. X    fclose(fi);
  394. X    Delay(50*5);
  395. X}
  396. X
  397. X
  398. Xchar *
  399. XGetLine()
  400. X{
  401. X    static char buf[256];
  402. X    static char tab[256];
  403. X    short col = 0;
  404. X    short i = 0;
  405. X    short limit = 5*60;     /*    5 minute idle timeout    */
  406. X    short lcnt = 0;
  407. X    short c;
  408. X
  409. X    for (;;) {
  410. X    c = GetDaChar();
  411. X    if (c == EOF) {
  412. X        clrerr(stdin);
  413. X        ++lcnt;
  414. X        if (lcnt == limit - 30) {
  415. X        puts("\r\n(idle, hangup in 30)\r\n");
  416. X        fflush(stdout);
  417. X        }
  418. X        if (lcnt == limit)
  419. X        break;
  420. X        continue;
  421. X    }
  422. X    lcnt = 0;
  423. X
  424. X    switch(c) {
  425. X    case 10:
  426. X    case 13:
  427. X        PutDaChar('\r');
  428. X        PutDaChar('\n');
  429. X        FlushChars();
  430. X        buf[i] = 0;
  431. X        return(buf);
  432. X    case 8:
  433. X    case 127:
  434. X        if (i) {
  435. X        short n = 1;
  436. X        --i;
  437. X        if (buf[i] == 9)
  438. X            n = tab[i];
  439. X        col -= n;
  440. X        while (n--) {
  441. X            PutDaChar('\010');
  442. X            PutDaChar(' ');
  443. X            PutDaChar('\010');
  444. X        }
  445. X        }
  446. X        break;
  447. X    case 'x'&0x1F:
  448. X        PutDaChar('^');
  449. X        PutDaChar('X');
  450. X        PutDaChar('\r');
  451. X        PutDaChar('\n');
  452. X        i = 0;
  453. X        break;
  454. X    case 'r'&0x1F:
  455. X        PutDaChar('\r');
  456. X        PutDaChar('\n');
  457. X        FlushChars();
  458. X        buf[i] = 0;
  459. X        printf("%s", buf);
  460. X        fflush(stdout);
  461. X        break;
  462. X    case 9:
  463. X        if (i < sizeof(buf) - 2) {
  464. X        tab[i] = 8 - (col & 7);
  465. X        col += tab[i] - 1;  /*    because we ++ below */
  466. X        }
  467. X        /* fall through */
  468. X    default:
  469. X        if (i < sizeof(buf) - 2) {
  470. X        PutDaChar(c);
  471. X        buf[i++] = c;
  472. X        ++col;
  473. X        } else {
  474. X        PutDaChar('g' & 0x1F);
  475. X        }
  476. X        break;
  477. X    }
  478. X    }
  479. X    return(NULL);
  480. X}
  481. X
  482. Xvoid
  483. XFlushChars()
  484. X{
  485. X    PutDaChar(256);
  486. X}
  487. X
  488. Xvoid
  489. XPutDaChar(c)
  490. X{
  491. X    static char buf[256];
  492. X    static short len;
  493. X
  494. X    if (c == 256 || len == sizeof(buf)) {
  495. X    if (len)
  496. X        write(0, buf, len);
  497. X    len = 0;
  498. X    }
  499. X    if (c != 256) {
  500. X    buf[len++] = c;
  501. X    }
  502. X}
  503. X
  504. X
  505. XGetDaChar()
  506. X{
  507. X    static char buf[256];
  508. X    static short idx, len;
  509. X
  510. X    if (idx == len) {
  511. X    if (read(0, buf, 0) < 0)
  512. X        FlushChars();
  513. X    idx = 0;
  514. X    len = read(0, buf, sizeof(buf));
  515. X    if (len <= 0) {
  516. X        len = 0;
  517. X        return(EOF);
  518. X    }
  519. X    }
  520. X    return((int)buf[idx++]);
  521. X}
  522. X
  523. END_OF_FILE
  524. if test 3220 -ne `wc -c <'src/GUtil/gnote.c'`; then
  525.     echo shar: \"'src/GUtil/gnote.c'\" unpacked with wrong size!
  526. fi
  527. # end of 'src/GUtil/gnote.c'
  528. fi
  529. if test -f 'src/GUtil/uuserdump.c' -a "${1}" != "-c" ; then 
  530.   echo shar: Will not clobber existing file \"'src/GUtil/uuserdump.c'\"
  531. else
  532. echo shar: Extracting \"'src/GUtil/uuserdump.c'\" \(3865 characters\)
  533. sed "s/^X//" >'src/GUtil/uuserdump.c' <<'END_OF_FILE'
  534. X
  535. X/*
  536. X *  UUSERDUMP.C
  537. X *
  538. X *  (C) Copyright 1989-1990 by Matthew Dillon,  All Rights Reserved.
  539. X *
  540. X *  UUSERDUMP filename
  541. X *
  542. X *  KEY THINGS ABOUT UUSER: USED AS STDIN/STDOUT
  543. X *
  544. X *    Currently UUSER: works only with single sessions started
  545. X *    by Getty (this has to do with how UUSER: deals with carrier
  546. X *    detect).  THIS WILL BE FIXED.
  547. X *
  548. X *    (1) Use Level 1 I/O if you can (read/write)
  549. X *        read() returns 0 on timeout, -1 on carrier lost
  550. X *        otherwise, read() returns the immediate number of
  551. X *        data bytes ready up to the amount you requested.
  552. X *        (i.e. if you read(0,buf,256) you can get anywhere from
  553. X *        -1, 0, 1 to 256 back).
  554. X *
  555. X *        write() returns the number you wrote or -1 (lost carrier)
  556. X *
  557. X *        To 'poll' data ready you can read(0, NULL, 0) .. reading
  558. X *        0 bytes returns 0 (data ready) or -1 (data not ready).
  559. X *        NOTE: 0 (data ready) will be returned if carrier is lost
  560. X *        when you read 0 bytes... this is so your program thinks
  561. X *        data is ready and when it does a real read it finds that
  562. X *        carrier was lost!
  563. X *
  564. X *    (2) If you want to use Level 2 I/O (stdio) I suggest you use
  565. X *        it for writing only.  If you really want to use it for
  566. X *        reading remember that the timeout will cause an EOF
  567. X *        condition which must be cleared (clrerr()).  And you
  568. X *        must call ferror() to determine whether an EOF is an
  569. X *        EOF (timeout()) or an actual error (lost carrier).
  570. X */
  571. X
  572. X#include <proto/all.h>
  573. X#include <stdio.h>
  574. X#include "/version.h"
  575. X
  576. XIDENT(".00");
  577. X
  578. Xvoid
  579. XCXBRK()             /*  on BREAK    */
  580. X{
  581. X    exit(1);
  582. X}
  583. X
  584. Xchar buf[256];
  585. Xshort i;
  586. X
  587. Xvoid
  588. Xmain(ac, av)
  589. Xchar *av[];
  590. X{
  591. X    short i;
  592. X    char c;
  593. X    short n;
  594. X    FILE *fi = fopen(av[1], "r");
  595. X
  596. X    /*
  597. X     *    set output to line buffering (stdio), else it will use
  598. X     *    file buffering!  Which is bad if we want to catch ^S/^C
  599. X     */
  600. X
  601. X    setvbuf(stdout, NULL, _IOLBF, 0);
  602. X
  603. X
  604. X    if (ac == 1)
  605. X    exit(1);
  606. X
  607. X    if (fi == NULL)
  608. X    printf("Info file %s not available\r\n", av[1]);
  609. X
  610. X    printf("Dumping info file (suggest capture), hit Enter when ready\n");
  611. X    fflush(stdout);
  612. X
  613. X    /*
  614. X     *    Getty uses the R1000 option, so there is a one second timeout
  615. X     *    on reads when no data is present.  If data is present, UUSER:
  616. X     *    returns the number of bytes immediately available regardless of
  617. X     *    how many you requested.
  618. X     */
  619. X
  620. X    for (i = 0; i < 60; ++i) {
  621. X    n = read(0, &c, 1);
  622. X    if (n < 0)              /*  lost carrier */
  623. X        exit(1);
  624. X                /*  success    */
  625. X    if (n > 0 && (c == 10 || c == 13))
  626. X        goto skip;
  627. X    /* timeout */
  628. X    }
  629. X    exit(1);
  630. Xskip:
  631. X    while (fgets(buf, 256, fi)) {
  632. X    if (CheckControl())
  633. X        break;
  634. X    fputs(buf, stdout);
  635. X    }
  636. X    fclose(fi);
  637. X
  638. X    printf("End of dump, any key to disconnect\n");
  639. X    fflush(stdout);
  640. X    for (i = 0; i < 60; ++i) {
  641. X    n = read(0, &c, 1);
  642. X    if (n == 0)     /*  1 second timeout    */
  643. X        continue;
  644. X    break;        /*  any key or lost cd    */
  645. X    }
  646. X}
  647. X
  648. X/*
  649. X *  Here we use a UUSER: trick ... requesting 0 bytes in a read()
  650. X *  incurs NO timeout.    0 is returned if data is ready, -1 if data
  651. X *  is not ready.
  652. X *
  653. X *  Another way to do it is to dump a seconds worth of data, then
  654. X *  call read() (which blocks for up to 1 second if no data is
  655. X *  ready, but the user doesn't see that because we've already queued
  656. X *  a second's worth of data).  The first method is better because
  657. X *  there is finer granularity (that is, the one used below)
  658. X */
  659. X
  660. XCheckControl()
  661. X{
  662. X    char c = 0;
  663. X    short n;
  664. X
  665. X    if (read(0, NULL, 0) == 0) {    /*  returns 0=data ready, -1=not rdy */
  666. X    read(0, &c, 1);
  667. X    if (c == ('s'&0x1F)) {      /*  ^S           */
  668. X        for (;;) {
  669. X        n = read(0, &c, 1);
  670. X        if (n < 0)          /*  lost carrier */
  671. X            exit(1);
  672. X        if (n == 0)         /*  timeout      */
  673. X            continue;
  674. X        break;            /*    got a key    */
  675. X        }
  676. X        return(0);
  677. X    }
  678. X    if (c == ('c'&0x1F))        /*  ^C           */
  679. X        return(1);
  680. X    }
  681. X    return(0);
  682. X}
  683. X
  684. END_OF_FILE
  685. if test 3865 -ne `wc -c <'src/GUtil/uuserdump.c'`; then
  686.     echo shar: \"'src/GUtil/uuserdump.c'\" unpacked with wrong size!
  687. fi
  688. # end of 'src/GUtil/uuserdump.c'
  689. fi
  690. if test -f 'src/News060/postnews.c' -a "${1}" != "-c" ; then 
  691.   echo shar: Will not clobber existing file \"'src/News060/postnews.c'\"
  692. else
  693. echo shar: Extracting \"'src/News060/postnews.c'\" \(4092 characters\)
  694. sed "s/^X//" >'src/News060/postnews.c' <<'END_OF_FILE'
  695. X
  696. X/*
  697. X *  PostNews.c
  698. X *
  699. X *  Copyright 1988 by William Loftus.  All rights reserved.
  700. X *
  701. X *  Version 0.60 Beta
  702. X */
  703. X
  704. X#include <time.h>
  705. X#include <stdio.h>
  706. X#include <stdlib.h>
  707. X#include "log.h"
  708. X
  709. Xchar *UserName;
  710. Xchar *NodeName;
  711. Xchar *RealName;
  712. Xchar *NewsEditor;
  713. Xchar *DomainName;
  714. Xchar to_buf[128];
  715. Xchar grp_buf[128];
  716. Xchar dist_buf[128];
  717. Xchar subject_buf[128];
  718. Xchar *temp_file_name;
  719. X
  720. Xint seq;
  721. X
  722. Xchar *NewsFeed;
  723. X
  724. Xchar cmd[128];
  725. Xchar path[128];
  726. Xchar signature[121];
  727. X
  728. Xvoid read_ctl();
  729. Xvoid GetTo();
  730. Xvoid GetDist();
  731. Xvoid GetSubject();
  732. Xvoid GetMessage();
  733. Xvoid BuildRnews();
  734. Xvoid Signature();
  735. Xvoid PromptGet();
  736. Xchar *TmpFileName();
  737. Xchar *FindConfig();
  738. X
  739. Xvoid
  740. Xerrormsg (msg)
  741. Xchar *msg;
  742. X{
  743. X    printf(msg);
  744. X}
  745. X
  746. X
  747. Xvoid
  748. Xmain()
  749. X{
  750. X    temp_file_name = TmpFileName("UUSPOOL:news");
  751. X
  752. X    LogProgram = "PostNews";
  753. X
  754. X    UserName = FindConfig("UserName");
  755. X    NodeName = FindConfig("NodeName");
  756. X    NewsFeed = FindConfig("NewsFeed");
  757. X    NewsEditor=FindConfig("NewsEditor");
  758. X    RealName = FindConfig("RealName");
  759. X    DomainName=FindConfig("DomainName");
  760. X
  761. X    if (UserName == NULL || NodeName == NULL || NewsFeed == NULL ||
  762. X    NewsEditor==NULL || RealName == NULL || DomainName == NULL)
  763. X    {
  764. X    printf("UULIB:Config incomplete, missing one or more of:\n");
  765. X    printf("    UserName, NodeName, DomainName, NewsFeed, NewsEditor, RealName\n");
  766. X    exit(1);
  767. X    }
  768. X
  769. X    GetTo();
  770. X    GetDist();
  771. X    GetSubject();
  772. X    GetMessage();
  773. X    BuildRnews();
  774. X}
  775. X
  776. Xvoid
  777. XGetTo()
  778. X{
  779. X    PromptGet("Newsgroup(s): ", 0, grp_buf, sizeof(grp_buf), stdin);
  780. X}
  781. X
  782. Xvoid
  783. XGetDist()
  784. X{
  785. X    FILE *fd;
  786. X    char  buf[128];
  787. X
  788. X    if (!(fd = fopen("UULIB:news.distribution", "r"))) {
  789. X    errormsg("Can't Find news.distribution file");
  790. X    exit(3);
  791. X    }
  792. X
  793. X    while (fgets(buf, sizeof buf, fd)) {
  794. X    printf("%s", buf);
  795. X    }
  796. X
  797. X    PromptGet("Distribution: ", 0, dist_buf, sizeof(dist_buf), stdin);
  798. X}
  799. X
  800. Xvoid
  801. XGetSubject()
  802. X{
  803. X    PromptGet("Subject: ", 1, subject_buf, sizeof(subject_buf), stdin);
  804. X}
  805. X
  806. Xvoid
  807. XGetMessage()
  808. X{
  809. X    FILE *fp;
  810. X    time_t t;
  811. X
  812. X    seq = GetSequence(4);
  813. X
  814. X    fp = fopen(temp_file_name, "w");
  815. X
  816. X    if (fp) {
  817. X    time(&t);
  818. X    fprintf(fp,"Relay-Version: X-AmigaNEWS version 0.60 BETA; site %s%s\n", NodeName, DomainName);
  819. X    fprintf(fp,"Posting-Version: X-AmigaNEWS version 0.60 BETA; site %s%s\n", NodeName, DomainName);
  820. X    fprintf(fp,"Path: %s!%s\n", NodeName, UserName);
  821. X    fprintf(fp,"From: %s@%s%s (%s)\n", UserName, NodeName, DomainName, RealName);
  822. X    fprintf(fp,"Newsgroups: %s", grp_buf);
  823. X    fprintf(fp,"Subject: %s", subject_buf);
  824. X    fprintf(fp,"Message-Id: <%05d.AA%05d@%s%s>\n", seq, seq, NodeName, DomainName);
  825. X    fprintf(fp,"Date: %s", ctime(&t));
  826. X    fprintf(fp,"Followup-To: %s", grp_buf);
  827. X    fprintf(fp,"Expires: \n");
  828. X    fprintf(fp,"Keywords: \n");
  829. X    fprintf(fp,"Distribution: %s\n\n", dist_buf);
  830. X
  831. X    fclose(fp);
  832. X    } else {
  833. X    errormsg("Can't open temp file %s\n", temp_file_name);
  834. X    exit(1);
  835. X    }
  836. X
  837. X    sprintf(cmd,"%s %s", NewsEditor, temp_file_name);
  838. X    system(cmd);
  839. X
  840. X    printf("Append .signature file? [y/n] ");
  841. X    fgets(signature, sizeof signature, stdin);
  842. X    if ((signature[0] | 0x20) != 'n') {
  843. X    Signature();
  844. X    printf(".signature file appended.\n");
  845. X    }
  846. X}
  847. X
  848. Xvoid
  849. XBuildRnews()
  850. X{
  851. X    NewsFeed[7] = '\0';
  852. X
  853. X    sprintf(cmd, "UUX %s \"%s!rnews\"", temp_file_name, NewsFeed);
  854. X    system(cmd);
  855. X    remove(temp_file_name);
  856. X}
  857. X
  858. X/*
  859. X * Read the control file and grab a few parameters.
  860. X */
  861. X
  862. Xvoid
  863. XSignature()
  864. X{
  865. X    FILE *fp;
  866. X    FILE *sf;
  867. X    char buff[128];
  868. X
  869. X    fp = fopen(temp_file_name, "a");  /* should already exist!! */
  870. X
  871. X    if (!fp) {
  872. X    errormsg("Can't open temp file--%s\n", temp_file_name);
  873. X    exit(1);
  874. X    }
  875. X
  876. X    fprintf(fp, "\n--\n");
  877. X
  878. X    sf = fopen("UULIB:.signature", "r");
  879. X
  880. X    if (sf) {
  881. X    while (NULL != fgets(buff, sizeof buff, sf)) {
  882. X        fprintf(fp, "%s", buff);
  883. X    }
  884. X    fclose(sf);
  885. X    } else {
  886. X    errormsg("Can't open UULIB:.signature file\n");
  887. X    }
  888. X    fclose(fp);
  889. X}
  890. X
  891. Xvoid
  892. XPromptGet(prompt, loop, buf, bufsize, fin)
  893. Xchar *prompt;
  894. Xchar *buf;
  895. XFILE *fin;
  896. X{
  897. X    short i;
  898. X
  899. X    do {
  900. X    printf("%s", prompt);
  901. X    fflush(stdout);
  902. X    if (fgets(buf, bufsize, fin) == NULL)
  903. X        break;
  904. X    for (i = 0; buf[i] == ' ' || buf[i] == 9; ++i);
  905. X    if (buf[i] != '\n')
  906. X        break;
  907. X    } while (loop);
  908. X}
  909. X
  910. X
  911. END_OF_FILE
  912. if test 4092 -ne `wc -c <'src/News060/postnews.c'`; then
  913.     echo shar: \"'src/News060/postnews.c'\" unpacked with wrong size!
  914. fi
  915. # end of 'src/News060/postnews.c'
  916. fi
  917. if test -f 'src/compress/tarsplit.c' -a "${1}" != "-c" ; then 
  918.   echo shar: Will not clobber existing file \"'src/compress/tarsplit.c'\"
  919. else
  920. echo shar: Extracting \"'src/compress/tarsplit.c'\" \(3856 characters\)
  921. sed "s/^X//" >'src/compress/tarsplit.c' <<'END_OF_FILE'
  922. X
  923. X/*
  924. X * TarSplit -- split up tar files (creating directories as needed)
  925. X *
  926. X * usage: TarSplit [pathname]
  927. X *
  928. X * semantics: splits up tar file taken from stdin (or pathname, if
  929. X * specified) and creates the files therein under the working data
  930. X * directory.
  931. X *
  932. X * AmigaDOS Version - no support for stdin.
  933. X */
  934. X
  935. X#include <stdio.h>
  936. X#include "/version.h"
  937. X
  938. XIDENT(".00");
  939. X
  940. X#ifdef    AMIGA
  941. X#include <stdlib.h>
  942. X#include <exec/types.h>
  943. X#include <proto/all.h>
  944. Xtypedef int    bool ;
  945. Xbool    ChkSumOK() ;
  946. X#include <libraries/dosextens.h>
  947. X#else
  948. X#include <modes.h>
  949. X#include <bool.h>
  950. X#define DIRMODE     (S_IREAD | S_IWRITE | S_IEXEC | S_IOREAD | S_IOEXEC)
  951. X#endif
  952. X#define TBLOCK    512
  953. X#define NAMSIZ    100
  954. X
  955. Xunion hblock {
  956. X    char dummy[TBLOCK];
  957. X    struct header {
  958. X        char name[NAMSIZ];
  959. X        char mode[8];
  960. X        char uid[8];
  961. X        char gid[8];
  962. X        char size[12];
  963. X        char mtime[12];
  964. X        char chksum[8];
  965. X        char linkflag;
  966. X        char linkname[NAMSIZ];
  967. X    } dbuf;
  968. X};
  969. X
  970. X#define BLKSIZE     (sizeof (union hblock))
  971. X#define HARDLINK    '1'
  972. X#define SYMBLINK    '2'
  973. X#define NORMAL        '\0'
  974. X
  975. Xvoid DoFile();
  976. X
  977. Xmain(argc, argv)
  978. Xint    argc;
  979. Xchar    *argv[];
  980. X{
  981. X    FILE        *TarFP;
  982. X    union hblock    TarBlock;
  983. X
  984. X#ifndef AMIGA
  985. X    /* make the compiler happy about formatted I/O for longs... */
  986. X    pflinit();
  987. X#endif
  988. X
  989. X    switch(argc) {
  990. X#ifndef AMIGA
  991. X    case 1:
  992. X        TarFP = stdin;
  993. X        break;
  994. X#endif
  995. X    case 2:
  996. X        if ((TarFP = fopen(argv[1], "r")) == NULL) {
  997. X            fprintf(stderr, "TarSplit: can't open %s\n", argv[1]);
  998. X            exit(1);
  999. X        }
  1000. X        break;
  1001. X    default:
  1002. X        fprintf(stderr, "usage: TarSplit [pathname]\n");
  1003. X        exit(1);
  1004. X    }
  1005. X
  1006. X    for (;;) {
  1007. X        if (fread((char *)&TarBlock, BLKSIZE, 1, TarFP) == NULL) {
  1008. X            fprintf(stderr, "TarSplit: premature EOF\n");
  1009. X            exit(1);
  1010. X        } else if (IsZero(&TarBlock)) {
  1011. X            while (fread((char *)&TarBlock, BLKSIZE, 1, TarFP) != NULL)
  1012. X                ;
  1013. X            break;
  1014. X        } else
  1015. X            DoFile(&TarBlock, TarFP);
  1016. X    }
  1017. X
  1018. X}
  1019. X
  1020. Xbool
  1021. XIsZero(block)
  1022. Xunion hblock    *block;
  1023. X{
  1024. X    int    i;
  1025. X    char    *cblock;
  1026. X
  1027. X    cblock = block->dummy;
  1028. X    for (i = 0; i < TBLOCK; i++)
  1029. X        if (*cblock++ != '\0')
  1030. X            return(FALSE);
  1031. X
  1032. X    return (TRUE);
  1033. X
  1034. X}
  1035. X
  1036. Xvoid
  1037. XDoFile(block, TarFP)
  1038. Xunion hblock    *block;
  1039. XFILE        *TarFP;
  1040. X{
  1041. X    long    FSize;
  1042. X    char    FName[NAMSIZ], *RefName;
  1043. X    int    i;
  1044. X    bool    IsDir, OpenOK;
  1045. X    FILE    *NewFP;
  1046. X
  1047. X    if (!ChkSumOK(block)) {
  1048. X        fprintf(stderr, "TarSplit: bad checksum, name %s?\n",
  1049. X            block->dbuf.name);
  1050. X        exit(1);
  1051. X    }
  1052. X
  1053. X    switch(block->dbuf.linkflag) {
  1054. X    case HARDLINK:
  1055. X    case SYMBLINK:
  1056. X        fprintf(stderr, "TarSplit: can't handle links\n");
  1057. X        exit(1);
  1058. X    case NORMAL:
  1059. X        break;
  1060. X    default:
  1061. X        fprintf(stderr, "TarSplit: unknown linkflag\n");
  1062. X        exit(1);
  1063. X    }
  1064. X
  1065. X#ifdef    AMIGA
  1066. X    if (sscanf(block->dbuf.size, "%12lo", &FSize) != 1) {
  1067. X#else
  1068. X    if (sscanf(block->dbuf.size, "%12O", &FSize) != 1) {
  1069. X#endif
  1070. X        fprintf(stderr, "TarSplit: bad size\n");
  1071. X        exit(1);
  1072. X    }
  1073. X
  1074. X    for (i = 0, RefName = block->dbuf.name; *RefName; i++, RefName++)
  1075. X        FName[i] = *RefName;
  1076. X
  1077. X    if (IsDir = (*(RefName - 1) == '/')) {
  1078. X        FName[i - 1] = '\0';
  1079. X        if (strcmp(FName, ".") == 0)
  1080. X            OpenOK = TRUE;
  1081. X        else
  1082. X#ifdef    AMIGA
  1083. X            {
  1084. X                BPTR Lock;
  1085. X                OpenOK = (Lock = CreateDir(FName)) != 0;
  1086. X                UnLock(Lock) ;
  1087. X            }
  1088. X#else
  1089. X            OpenOK = mknod(FName, DIRMODE) == 0;
  1090. X#endif
  1091. X    } else {
  1092. X        FName[i] = '\0';
  1093. X        OpenOK = (NewFP = fopen(FName, "w")) != NULL;
  1094. X    }
  1095. X
  1096. X    if (!OpenOK) {
  1097. X        fprintf(stderr, "TarSplit: can't create %s\n", FName);
  1098. X        exit(1);
  1099. X    }
  1100. X
  1101. X    for (; FSize > 0; FSize -= TBLOCK) {
  1102. X        if (fread((char *)block, BLKSIZE, 1, TarFP) == NULL) {
  1103. X            fprintf(stderr, "TarSplit: premature EOF\n");
  1104. X            exit(1);
  1105. X        }
  1106. X        if (!IsDir)
  1107. X            fwrite(block->dummy, 1,
  1108. X                (FSize > TBLOCK ? TBLOCK : (int) FSize), NewFP);
  1109. X    }
  1110. X
  1111. X    if (!IsDir)
  1112. X        fclose(NewFP);
  1113. X}
  1114. X
  1115. Xbool
  1116. XChkSumOK(block)
  1117. Xunion hblock    *block;
  1118. X{
  1119. X    long    Accum, ChkSumVal;
  1120. X    int    i;
  1121. X
  1122. X#ifdef    AMIGA
  1123. X    sscanf(block->dbuf.chksum, "%8lo", &ChkSumVal);
  1124. X#else
  1125. X    sscanf(block->dbuf.chksum, "%8O", &ChkSumVal);
  1126. X#endif
  1127. X    for (i = 0; i < 8; i++)
  1128. X        block->dbuf.chksum[i] = ' ';
  1129. X
  1130. X    Accum = 0;
  1131. X    for (i = 0; i < TBLOCK; i++)
  1132. X        Accum += 0xff & block->dummy[i];
  1133. X
  1134. X    return(Accum == ChkSumVal);
  1135. X
  1136. X}
  1137. END_OF_FILE
  1138. if test 3856 -ne `wc -c <'src/compress/tarsplit.c'`; then
  1139.     echo shar: \"'src/compress/tarsplit.c'\" unpacked with wrong size!
  1140. fi
  1141. # end of 'src/compress/tarsplit.c'
  1142. fi
  1143. if test -f 'src/compress/uudecode.c' -a "${1}" != "-c" ; then 
  1144.   echo shar: Will not clobber existing file \"'src/compress/uudecode.c'\"
  1145. else
  1146. echo shar: Extracting \"'src/compress/uudecode.c'\" \(3204 characters\)
  1147. sed "s/^X//" >'src/compress/uudecode.c' <<'END_OF_FILE'
  1148. X/*
  1149. X * uudecode [input]
  1150. X *
  1151. X * create the specified file, decoding as you go.
  1152. X * used with uuencode.
  1153. X */
  1154. X
  1155. X#include <stdio.h>
  1156. X#include "/version.h"
  1157. X
  1158. XIDENT(".00");
  1159. X
  1160. X#ifdef UNIX
  1161. X# include <pwd.h>
  1162. X# include <sys/types.h>
  1163. X# include <sys/stat.h>
  1164. X#endif
  1165. X
  1166. X#ifdef VMS
  1167. X# include <types.h>
  1168. X# include <stat.h>
  1169. X#endif
  1170. X
  1171. X/* single character decode */
  1172. X#define DEC(c)  (((c) - ' ') & 077)
  1173. X
  1174. Xvoid outdec();
  1175. Xvoid decode();
  1176. X
  1177. Xvoid
  1178. Xmain(argc, argv)
  1179. Xchar **argv;
  1180. X{
  1181. X    FILE *in, *out;
  1182. X#ifdef UNIX | VMS
  1183. X    struct stat sbuf;
  1184. X#endif
  1185. X    int mode;
  1186. X    char dest[128];
  1187. X    char buf[80];
  1188. X
  1189. X    /* optional input arg */
  1190. X    if (argc > 1) {
  1191. X        if ((in = fopen(argv[1], "r")) == NULL) {
  1192. X            perror(argv[1]);
  1193. X            exit(1);
  1194. X        }
  1195. X        argv++; argc--;
  1196. X    } else
  1197. X        in = stdin;
  1198. X
  1199. X    if (argc != 1) {
  1200. X        printf("Usage: uudecode [infile]\n");
  1201. X        exit(2);
  1202. X    }
  1203. X
  1204. X    /* search for header line */
  1205. X    for (;;) {
  1206. X        if (fgets(buf, sizeof buf, in) == NULL) {
  1207. X            fprintf(stderr, "No begin line\n");
  1208. X            exit(3);
  1209. X        }
  1210. X        if (strncmp(buf, "begin ", 6) == 0)
  1211. X            break;
  1212. X    }
  1213. X    sscanf(buf, "begin %o %s", &mode, dest);
  1214. X
  1215. X#ifdef UNIX
  1216. X    /* handle ~user/file format */
  1217. X    if (dest[0] == '~') {
  1218. X        char *sl;
  1219. X        struct passwd *getpwnam();
  1220. X        char *index();
  1221. X        struct passwd *user;
  1222. X        char dnbuf[100];
  1223. X
  1224. X        sl = index(dest, '/');
  1225. X        if (sl == NULL) {
  1226. X            fprintf(stderr, "Illegal ~user\n");
  1227. X            exit(3);
  1228. X        }
  1229. X        *sl++ = 0;
  1230. X        user = getpwnam(dest+1);
  1231. X        if (user == NULL) {
  1232. X            fprintf(stderr, "No such user as %s\n", dest);
  1233. X            exit(4);
  1234. X        }
  1235. X        strcpy(dnbuf, user->pw_dir);
  1236. X        strcat(dnbuf, "/");
  1237. X        strcat(dnbuf, sl);
  1238. X        strcpy(dest, dnbuf);
  1239. X    }
  1240. X#endif /* UNIX */
  1241. X
  1242. X    /* create output file */
  1243. X    out = fopen(dest, "w");
  1244. X    if (out == NULL) {
  1245. X        perror(dest);
  1246. X        exit(4);
  1247. X    }
  1248. X#ifdef UNIX | VMS
  1249. X    chmod(dest, mode);
  1250. X#endif
  1251. X
  1252. X    decode(in, out);
  1253. X
  1254. X    if (fgets(buf, sizeof buf, in) == NULL || strcmp(buf, "end\n")) {
  1255. X        fprintf(stderr, "No end line\n");
  1256. X        exit(5);
  1257. X    }
  1258. X    exit(0);
  1259. X}
  1260. X
  1261. X/*
  1262. X * copy from in to out, decoding as you go along.
  1263. X */
  1264. X
  1265. Xvoid
  1266. Xdecode(in, out)
  1267. XFILE *in;
  1268. XFILE *out;
  1269. X{
  1270. X    char buf[80];
  1271. X    char *bp;
  1272. X    int n;
  1273. X
  1274. X    for (;;) {
  1275. X        /* for each input line */
  1276. X        if (fgets(buf, sizeof buf, in) == NULL) {
  1277. X            printf("Short file\n");
  1278. X            exit(10);
  1279. X        }
  1280. X        n = DEC(buf[0]);
  1281. X        if (n <= 0)
  1282. X            break;
  1283. X
  1284. X        bp = &buf[1];
  1285. X        while (n > 0) {
  1286. X            outdec(bp, out, n);
  1287. X            bp += 4;
  1288. X            n -= 3;
  1289. X        }
  1290. X    }
  1291. X}
  1292. X
  1293. X/*
  1294. X * output a group of 3 bytes (4 input characters).
  1295. X * the input chars are pointed to by p, they are to
  1296. X * be output to file f.  n is used to tell us not to
  1297. X * output all of them at the end of the file.
  1298. X */
  1299. X
  1300. Xvoid
  1301. Xoutdec(p, f, n)
  1302. Xchar *p;
  1303. XFILE *f;
  1304. X{
  1305. X    int c1, c2, c3;
  1306. X
  1307. X    c1 = DEC(*p) << 2 | DEC(p[1]) >> 4;
  1308. X    c2 = DEC(p[1]) << 4 | DEC(p[2]) >> 2;
  1309. X    c3 = DEC(p[2]) << 6 | DEC(p[3]);
  1310. X    if (n >= 1)
  1311. X        putc(c1, f);
  1312. X    if (n >= 2)
  1313. X        putc(c2, f);
  1314. X    if (n >= 3)
  1315. X        putc(c3, f);
  1316. X}
  1317. X
  1318. X
  1319. X/* fr: like read but stdio */
  1320. Xint
  1321. Xfr(fd, buf, cnt)
  1322. XFILE *fd;
  1323. Xchar *buf;
  1324. Xint cnt;
  1325. X{
  1326. X    int c, i;
  1327. X
  1328. X    for (i=0; i<cnt; i++) {
  1329. X        c = getc(fd);
  1330. X        if (c == EOF)
  1331. X            return(i);
  1332. X        buf[i] = c;
  1333. X    }
  1334. X    return (cnt);
  1335. X}
  1336. X
  1337. X/*
  1338. X * Return the ptr in sp at which the character c appears;
  1339. X * NULL if not found
  1340. X */
  1341. X
  1342. Xchar *
  1343. Xindex(sp, c)
  1344. Xregister char *sp, c;
  1345. X{
  1346. X    do {
  1347. X        if (*sp == c)
  1348. X            return(sp);
  1349. X    } while (*sp++);
  1350. X    return(NULL);
  1351. X}
  1352. X
  1353. X#ifdef AMIGA
  1354. Xperror(err)
  1355. Xchar *err;
  1356. X{
  1357. X    printf("Can not open file \"%s\"\n", err);
  1358. X    return(NULL);
  1359. X}
  1360. X#endif
  1361. END_OF_FILE
  1362. if test 3204 -ne `wc -c <'src/compress/uudecode.c'`; then
  1363.     echo shar: \"'src/compress/uudecode.c'\" unpacked with wrong size!
  1364. fi
  1365. # end of 'src/compress/uudecode.c'
  1366. fi
  1367. if test -f 'src/dmail/do_lists.c' -a "${1}" != "-c" ; then 
  1368.   echo shar: Will not clobber existing file \"'src/dmail/do_lists.c'\"
  1369. else
  1370. echo shar: Extracting \"'src/dmail/do_lists.c'\" \(4023 characters\)
  1371. sed "s/^X//" >'src/dmail/do_lists.c' <<'END_OF_FILE'
  1372. X
  1373. X/*
  1374. X *  DO_LISTS.C
  1375. X *
  1376. X *  (C) Copyright 1985-1990 by Matthew Dillon,  All Rights Reserved.
  1377. X *
  1378. X *  Global Routines:    DO_SETLIST()
  1379. X *            DO_LIST()
  1380. X *            DO_SELECT()
  1381. X *            DO_DEFER()
  1382. X *
  1383. X *  Static Routines:    None.
  1384. X *
  1385. X *    LIST associated commands.
  1386. X *
  1387. X */
  1388. X
  1389. X#include <stdio.h>
  1390. X#include "dmail.h"
  1391. X
  1392. X
  1393. Xdo_setlist(str)
  1394. Xchar *str;
  1395. X{
  1396. X    int i, fw, idx, localecho = 1;
  1397. X    int sac = 1;
  1398. X
  1399. X    push_break();
  1400. X    if (ac > sac && strcmp (av[sac], "-s") == 0) {
  1401. X    ++sac;
  1402. X    localecho = 0;
  1403. X    }
  1404. X    hold_load();
  1405. X    if (ac > sac) {
  1406. X    Listsize = 0;
  1407. X    for (i = sac; i < ac; ++i) {
  1408. X        fw = atoi(av[i]);
  1409. X        if (fw > 4096)
  1410. X        fw = 4096;
  1411. X        if (fw < 0  ||  (*av[i] < '0'  ||  *av[i] > '9'))
  1412. X        fw = 20;
  1413. X        else
  1414. X        ++i;
  1415. X        if (i >= ac)
  1416. X        continue;
  1417. X        idx = get_extra_ovr (av[i]);
  1418. X        if (idx < 0) {
  1419. X        printf ("To many entries, cannot load: %s\n", av[i]);
  1420. X        fflush (stdout);
  1421. X        continue;
  1422. X        }
  1423. X        header[Listsize] = idx;
  1424. X        width[Listsize] = fw;
  1425. X        ++Listsize;
  1426. X    }
  1427. X    }
  1428. X    nohold_load();
  1429. X    pop_break();
  1430. X    if (localecho) {
  1431. X    puts ("");
  1432. X    printf ("Entry   Width   Field\n\n");
  1433. X    for (i = 0; i < Listsize; ++i)
  1434. X        printf ("%-6d   %-5d   %s\n", i, width[i], Find[header[i]].search);
  1435. X    puts ("");
  1436. X    }
  1437. X    return (1);
  1438. X}
  1439. X
  1440. X
  1441. X/*
  1442. X * Pre-position #   0 >     Current article
  1443. X *            1 -     Read already
  1444. X */
  1445. X
  1446. Xdo_rlist()
  1447. X{
  1448. X    int num = 20;
  1449. X    int istart = Current, iend = Current;
  1450. X    short dir = 1;
  1451. X    short try;
  1452. X    char buf[64];
  1453. X
  1454. X    if (av[1])
  1455. X    num = atoi(av[1]);
  1456. X    if (num < 0) {
  1457. X    dir = -1;
  1458. X    num = -num;
  1459. X    }
  1460. X    for (try = 0; try < 2 && num; ++try, (dir = -dir)) {
  1461. X    int i;
  1462. X    if (dir < 0) {
  1463. X        for (i = Current; i >= 0 && num; --i) {
  1464. X        if (Entry[i].no && !(Entry[i].status & ST_DELETED)) {
  1465. X            istart = i;
  1466. X            --num;
  1467. X        }
  1468. X        }
  1469. X    } else {
  1470. X        for (i = Current; i < Entries && num; ++i) {
  1471. X        if (Entry[i].no && !(Entry[i].status & ST_DELETED)) {
  1472. X            iend = i;
  1473. X            --num;
  1474. X        }
  1475. X        }
  1476. X    }
  1477. X    }
  1478. X    if (istart != iend) {
  1479. X    sprintf(buf, "%d-%d", Entry[istart].no, Entry[iend].no);
  1480. X    ac = 2;
  1481. X    av[1] = buf;
  1482. X    return(do_list());
  1483. X    } else {
  1484. X    return(-1);
  1485. X    }
  1486. X}
  1487. X
  1488. Xdo_list()
  1489. X{
  1490. X    int i, j;
  1491. X    static char curr[10] = { "    " };
  1492. X
  1493. X    if (ac == 1) {
  1494. X    av[1] = "all";
  1495. X    ++ac;
  1496. X    }
  1497. X    if (push_base()) {
  1498. X    push_break();
  1499. X    pop_base();
  1500. X    PAGER (-1);
  1501. X    pop_break();
  1502. X    return (-1);
  1503. X    }
  1504. X    PAGER (0);
  1505. X    FPAGER ("\n         ");
  1506. X    for (j = 0; j < Listsize; ++j) {
  1507. X    if (width[j]) {
  1508. X        sprintf (Puf, "%-*.*s",
  1509. X            2 + width[j],
  1510. X            2 + width[j],
  1511. X            Find[header[j]].search);
  1512. X        FPAGER (Puf);
  1513. X    }
  1514. X    }
  1515. X    FPAGER ("\n");
  1516. X    rewind_range (1);
  1517. X    while (i = get_range()) {
  1518. X    i = indexof(i);
  1519. X    if (Entry[i].no  &&  ((Entry[i].status & ST_DELETED) == 0)) {
  1520. X        curr[0] = (Entry[i].status & ST_TAG) ? 'T' : ' ';
  1521. X        curr[1] = (i == Current) ? '>' : ' ';
  1522. X        curr[2] = (Entry[i].status & ST_READ)    ? 'r' : ' ';
  1523. X        curr[3] = (Entry[i].status & ST_STORED)  ? 'w' : ' ';
  1524. X        sprintf (Puf, "%s%-3d", curr, Entry[i].no);
  1525. X        FPAGER (Puf);
  1526. X        for (j = 0; j < Listsize; ++j) {
  1527. X        if (width[j]) {
  1528. X            sprintf(Puf, "  %-*.*s",
  1529. X                width[j],
  1530. X                width[j],
  1531. X                Entry[i].fields[header[j]]);
  1532. X            FPAGER (Puf);
  1533. X        }
  1534. X        }
  1535. X        FPAGER ("\n");
  1536. X    }
  1537. X    }
  1538. X    FPAGER ("\n");
  1539. X    PAGER (-1);
  1540. X    pop_base();
  1541. X    return (1);
  1542. X}
  1543. X
  1544. X
  1545. X
  1546. Xdo_select(str, mode)
  1547. Xchar *str;
  1548. X{
  1549. X    int ret = 1;
  1550. X    int localecho = 1;
  1551. X    int avi = 1;
  1552. X    int scr;
  1553. X    if (ac == 1)
  1554. X    return (1);
  1555. X    if (strcmp (av[avi], "-s") == 0) {
  1556. X    localecho = 0;
  1557. X    ++avi;
  1558. X    --ac;
  1559. X    }
  1560. X    switch (ac) {
  1561. X    case 2:
  1562. X    if (localecho)
  1563. X        puts ("SELECT ALL");
  1564. X    ret = m_select (Nulav, mode);
  1565. X    break;
  1566. X    case 1:
  1567. X    break;
  1568. X    default:
  1569. X    ret = m_select (av + avi, mode);
  1570. X    scr = indexof(0);
  1571. X    if (scr > 0  &&  localecho)
  1572. X        printf ("%d  Entries selected\n", Entry[scr].no);
  1573. X    break;
  1574. X    }
  1575. X    if (ret < 0  &&  localecho) {
  1576. X    puts ("Null field");
  1577. X    return (-1);
  1578. X    }
  1579. X    return (1);
  1580. X}
  1581. X
  1582. X
  1583. Xdo_defer()
  1584. X{
  1585. X    register int i, j;
  1586. X
  1587. X    push_break();
  1588. X    j = 1;
  1589. X    for (i = 0; i < Entries; ++i) {
  1590. X    if (Entry[i].no)
  1591. X        Entry[i].no = (Entry[i].status & ST_READ) ? 0 : j++;
  1592. X    }
  1593. X    pop_break();
  1594. X    return (1);
  1595. X}
  1596. X
  1597. END_OF_FILE
  1598. if test 4023 -ne `wc -c <'src/dmail/do_lists.c'`; then
  1599.     echo shar: \"'src/dmail/do_lists.c'\" unpacked with wrong size!
  1600. fi
  1601. # end of 'src/dmail/do_lists.c'
  1602. fi
  1603. if test -f 'src/lib/alias.c' -a "${1}" != "-c" ; then 
  1604.   echo shar: Will not clobber existing file \"'src/lib/alias.c'\"
  1605. else
  1606. echo shar: Extracting \"'src/lib/alias.c'\" \(4268 characters\)
  1607. sed "s/^X//" >'src/lib/alias.c' <<'END_OF_FILE'
  1608. X
  1609. X/*
  1610. X *  ALIAS.C
  1611. X *
  1612. X *  (C) Copyright 1989-1990 by Matthew Dillon,  All Rights Reserved.
  1613. X *
  1614. X *  Interpret UULIB:Aliases file.  To save space we do not load
  1615. X *  the entire file, just sections on demand.
  1616. X *
  1617. X *  #    = comment
  1618. X *  id: name [, name...]
  1619. X *
  1620. X *  name is a user name, path, or |filter, or quoted name.  Example,
  1621. X *  "|more" or "|rnews"
  1622. X */
  1623. X
  1624. X#include <proto/all.h>
  1625. X#include <stdio.h>
  1626. X#include <stdlib.h>
  1627. X#include <fcntl.h>
  1628. X#include <time.h>
  1629. X
  1630. X#include "log.h"
  1631. X
  1632. X#define HASHSIZE    256
  1633. X#define HASHMASK    (HASHSIZE-1)
  1634. X
  1635. X#define HF_TERM     0x01    /*    terminator name     */
  1636. X#define HF_ALIAS    0x02    /*    alias            */
  1637. X#define HF_LOADED   0x04    /*    def loaded        */
  1638. X
  1639. Xtypedef struct Hash {
  1640. X    struct Hash *Next;
  1641. X    short   NumAlias;    /*  # of aliases    */
  1642. X    short   Flags;
  1643. X    char    *Name;    /*  aliased user name    */
  1644. X    union {
  1645. X    struct Hash    **Alias;    /*  list of aliases       */
  1646. X    long    Offset;     /*    offset into file    */
  1647. X    } u;
  1648. X} Hash;
  1649. X
  1650. Xstatic Hash    *HashTab[HASHSIZE];
  1651. Xstatic char    Tmp[256];
  1652. X
  1653. Xvoid
  1654. XLoadAliases()
  1655. X{
  1656. X    FILE *fi = fopen("UULIB:Aliases", "r");
  1657. X    short i;
  1658. X    short j;
  1659. X    short k;
  1660. X    short line = 0;
  1661. X    long newoffset = 0;
  1662. X    long offset;
  1663. X    Hash *h;
  1664. X    char *buf = Tmp;
  1665. X
  1666. X    if (fi == NULL) {
  1667. X    ulog(-1, "Can't open UULIB:Aliases");
  1668. X    return;
  1669. X    }
  1670. X    while (fgets(buf, 256, fi)) {
  1671. X    offset = newoffset;
  1672. X    newoffset = ftell(fi);
  1673. X    ++line;
  1674. X    for (i = 0; buf[i] == ' ' || buf[i] == 9; ++i);
  1675. X    if (buf[i] == '#' || buf[i] == '\n')
  1676. X        continue;
  1677. X    for (j = i; buf[j] && buf[j] != ':'; ++j);
  1678. X    if (buf[j] == 0) {
  1679. X        ulog(-1, "No Colon UULIB:Aliases line %d", line);
  1680. X        continue;
  1681. X    }
  1682. X    buf[j] = 0;
  1683. X
  1684. X    k = HashFunc(buf + i);
  1685. X    h = malloc(sizeof(Hash));
  1686. X    h->Next = HashTab[k];
  1687. X    h->NumAlias = 0;
  1688. X    h->Flags = HF_ALIAS;
  1689. X    h->Name = malloc(strlen(buf+i) + 1);
  1690. X    h->u.Offset = offset + j + 1;
  1691. X    strcpy(h->Name, buf + i);
  1692. X
  1693. X    HashTab[k] = h;
  1694. X    }
  1695. X    fclose(fi);
  1696. X}
  1697. X
  1698. Xstatic
  1699. XHash *
  1700. XFindHashObject(name)
  1701. Xchar *name;
  1702. X{
  1703. X    short k = HashFunc(name);
  1704. X    Hash *h;
  1705. X
  1706. X    for (h = HashTab[k]; h; h = h->Next) {
  1707. X    if (strcmp(name, h->Name) == 0)
  1708. X        return(h);
  1709. X    }
  1710. X    return(NULL);
  1711. X}
  1712. X
  1713. Xstatic
  1714. Xvoid
  1715. XLoadHashObject(hash)
  1716. XHash *hash;
  1717. X{
  1718. X    FILE *fi = fopen("UULIB:Aliases", "r");
  1719. X    char *buf = Tmp;
  1720. X    short i, j;
  1721. X    short c;
  1722. X    short numalloc = 4;
  1723. X    Hash **hv = malloc(sizeof(Hash *) * 4);
  1724. X    Hash *h;
  1725. X
  1726. X    if (fi == NULL) {
  1727. X    ulog(-1, "Can't open UULIB:Aliases");
  1728. X    return;
  1729. X    }
  1730. X
  1731. X    hash->Flags |= HF_LOADED;
  1732. X    fseek(fi, hash->u.Offset, 0);
  1733. X    while (fgets(buf, 256, fi)) {
  1734. X    i = 0;
  1735. X    c = 'x';
  1736. X
  1737. X    for (;;) {
  1738. X        while (buf[i] == ' ' || buf[i] == 9)
  1739. X        ++i;
  1740. X        if (buf[i] == 0 || buf[i] == '\n')
  1741. X        break;
  1742. X
  1743. X        for (j = i; buf[j] != '\n' && buf[j] != ' ' && buf[j] != 9 && buf[j] != ','; ++j) {
  1744. X        if (buf[j] == '\"') {
  1745. X            i = j + 1;
  1746. X            for (++j; buf[j] != '\n' && buf[j] != '\"'; ++j);
  1747. X            break;
  1748. X        }
  1749. X        }
  1750. X        c = buf[j];
  1751. X        buf[j] = 0;
  1752. X
  1753. X        if ((h = FindHashObject(buf + i)) == NULL) {
  1754. X        short k = HashFunc(buf + i);
  1755. X
  1756. X        h = malloc(sizeof(Hash));
  1757. X        h->Next = HashTab[k];
  1758. X        h->NumAlias = 0;
  1759. X        h->Flags = HF_TERM;
  1760. X        h->Name = malloc(strlen(buf + i) + 1);
  1761. X        h->u.Alias = NULL;
  1762. X        strcpy(h->Name, buf + i);
  1763. X
  1764. X        HashTab[k] = h;
  1765. X        }
  1766. X
  1767. X        if (hash->NumAlias == numalloc) {
  1768. X        Hash **hvo = hv;
  1769. X        short add = 4;
  1770. X
  1771. X        hv = malloc(sizeof(Hash *) * (numalloc + add));
  1772. X        movmem((char *)hvo, (char *)hv, sizeof(Hash *) * numalloc);
  1773. X        numalloc += add;
  1774. X        }
  1775. X        hv[hash->NumAlias++] = h;
  1776. X
  1777. X        i = j + 1;
  1778. X        if (c == '\"')
  1779. X        c = buf[i++];
  1780. X        if (c == '\n' || c == 0)
  1781. X        i = j;
  1782. X    }
  1783. X    if (c != ',')
  1784. X        break;
  1785. X    }
  1786. X    hash->u.Alias = hv;
  1787. X}
  1788. X
  1789. Xvoid
  1790. XUserAliasList(user, callback)
  1791. Xchar *user;
  1792. Xvoid (*callback)();
  1793. X{
  1794. X    short i;
  1795. X    Hash *hash = FindHashObject(user);
  1796. X    static short stack;
  1797. X
  1798. X    if (++stack == 32) {
  1799. X    ulog(-1, "UULIB:Aliases recursion near user %s", user);
  1800. X    --stack;
  1801. X    return;
  1802. X    }
  1803. X
  1804. X    if (hash && (hash->Flags & HF_TERM) == 0) {
  1805. X    if ((hash->Flags & HF_LOADED) == 0)
  1806. X        LoadHashObject(hash);
  1807. X    for (i = 0; i < hash->NumAlias; ++i) {
  1808. X        Hash *h = hash->u.Alias[i];
  1809. X        UserAliasList(h->Name, callback);
  1810. X    }
  1811. X    } else {
  1812. X    (*callback)(user);
  1813. X    }
  1814. X    --stack;
  1815. X}
  1816. X
  1817. Xstatic int
  1818. XHashFunc(str)
  1819. Xchar *str;
  1820. X{
  1821. X    unsigned long v = 0x14FBA5C3;
  1822. X    while (*str) {
  1823. X    v = (v << 5) ^ (*str & 0x1F) ^ (v >> 27);
  1824. X    ++str;
  1825. X    }
  1826. X    return((int)(v & HASHMASK));
  1827. X}
  1828. X
  1829. END_OF_FILE
  1830. if test 4268 -ne `wc -c <'src/lib/alias.c'`; then
  1831.     echo shar: \"'src/lib/alias.c'\" unpacked with wrong size!
  1832. fi
  1833. # end of 'src/lib/alias.c'
  1834. fi
  1835. if test -f 'src/sendmail/domain.c' -a "${1}" != "-c" ; then 
  1836.   echo shar: Will not clobber existing file \"'src/sendmail/domain.c'\"
  1837. else
  1838. echo shar: Extracting \"'src/sendmail/domain.c'\" \(4164 characters\)
  1839. sed "s/^X//" >'src/sendmail/domain.c' <<'END_OF_FILE'
  1840. X
  1841. X/*
  1842. X *  DOMAIN.C
  1843. X *
  1844. X *  (C) Copyright 1989-1990 by Matthew Dillon,  All Rights Reserved.
  1845. X *
  1846. X *  Given the first machine in a path scan the domain list and
  1847. X *  return the type, class, and address of the resource entry.
  1848. X *
  1849. X *  AUTOMATIC HACKS:    scans L.sys file and automatically deals
  1850. X *            with machine[.UUCP] domain, returning
  1851. X *            Type=MD Class=UU Addr=machine.UUCP
  1852. X */
  1853. X
  1854. X#include <proto/all.h>
  1855. X#include <stdio.h>
  1856. X#include <stdlib.h>
  1857. X
  1858. Xextern char *DefaultNode;
  1859. X
  1860. XDomainLookup(name, len, tb, cb, ab)
  1861. Xchar *name;
  1862. Xchar *tb;
  1863. Xchar *cb;
  1864. Xchar *ab;
  1865. X{
  1866. X    char *dary[16];
  1867. X    char *tmp = malloc(len + 1);
  1868. X    char *tbase = tmp;
  1869. X    short b, i;
  1870. X    short di;
  1871. X    FILE *fi;
  1872. X    short level;        /*    best domain level found so far */
  1873. X    static char buf[256];
  1874. X
  1875. X    for (b = i = di = 0; i < len && name[i] != '!'; ++i) {
  1876. X    if (name[i] == '.') {
  1877. X        if (di == sizeof(dary)/sizeof(dary[0]) - 1) {
  1878. X        ulog(-1, "DomainLookup, too many domains! %s", name);
  1879. X        break;
  1880. X        }
  1881. X        strncpy(tmp, name + b, i - b);
  1882. X        tmp[i - b] = 0;
  1883. X        dary[di] = tmp;
  1884. X        tmp += i - b + 1;
  1885. X        b = i + 1;
  1886. X        ++di;
  1887. X    }
  1888. X    }
  1889. X    strncpy(tmp, name + b, i - b);
  1890. X    tmp[i - b] = 0;
  1891. X    dary[di++] = tmp;
  1892. X
  1893. X#ifdef NOTDEF
  1894. X    {
  1895. X    short i;
  1896. X    for (i = 0; i < di; ++i)
  1897. X        printf("XX '%s'\n", dary[i]);
  1898. X    }
  1899. X#endif
  1900. X
  1901. X    fi = fopen("UULIB:Domain", "r");
  1902. X    level = 0;
  1903. X    if (fi) {
  1904. X    while (fgets(buf, sizeof(buf), fi)) {
  1905. X        short l2;
  1906. X        short di2 = 0;
  1907. X        char *dary2[16];
  1908. X
  1909. X        if (buf[0] == ' ' || buf[0] == 9 || buf[0] == '\n' || buf[0] == '#')
  1910. X        continue;
  1911. X        for (b = i = 0; buf[i] && buf[i] != ' ' && buf[i] != 9; ++i) {
  1912. X        if (buf[i] == '.') {
  1913. X            if (di2 == sizeof(dary2)/sizeof(dary2[0]) - 1) {
  1914. X            ulog(-1, "UULIB:Domain, entry has too many subdomains: %s", buf);
  1915. X            break;
  1916. X            }
  1917. X            dary2[di2++] = buf + b;
  1918. X            buf[i] = 0;
  1919. X            b = i + 1;
  1920. X        }
  1921. X        }
  1922. X        buf[i] = 0;
  1923. X        dary2[di2++] = buf + b;
  1924. X
  1925. X        buf[i] = 0;     /*  get domain name/wildcard        */
  1926. X
  1927. X        l2 = CompareDomain(dary, di, dary2, di2);
  1928. X
  1929. X#ifdef NOTDEF
  1930. X        {
  1931. X        short i;
  1932. X        printf("\nres %d\n", l2);
  1933. X        for (i = 0; i < di; ++i)
  1934. X            printf("#1 %s\n", dary[i]);
  1935. X        for (i = 0; i < di2; ++i)
  1936. X            printf("#2 %s\n", dary2[i]);
  1937. X        }
  1938. X#endif
  1939. X
  1940. X        if (l2 > level) {   /*  better domain then what we have     */
  1941. X        sscanf(buf + i + 1, "%s %s %s", tb, cb, ab);
  1942. X        level = l2;
  1943. X        }
  1944. X    }
  1945. X    fclose(fi);
  1946. X    }
  1947. X
  1948. X    /*
  1949. X     *    Couldn't find the appropriate domain entry, check L.sys
  1950. X     *    OR domain entry is a forwarder, check L.sys
  1951. X     */
  1952. X
  1953. X    if (strcmp(tb, "MF") == 0 || level == 0) {
  1954. X    if (fi = fopen("UULIB:L.sys", "r")) {
  1955. X        while (fgets(buf, sizeof(buf), fi)) {
  1956. X        if (buf[0] == ' ' || buf[0] == 9 || buf[0] == '#' || buf[0] == '\n')
  1957. X            continue;
  1958. X        for (i = 0; buf[i] && buf[i] != ' ' && buf[i] != 9; ++i);
  1959. X        buf[i] = 0;
  1960. X        if (strcmpi(dary[0], buf) == 0) {
  1961. X            strcpy(tb, "MD");
  1962. X            strcpy(cb, "UU");
  1963. X            strcpy(ab, buf);
  1964. X            strcat(ab, ".UUCP");
  1965. X            level = 1;
  1966. X            break;
  1967. X        }
  1968. X        }
  1969. X        fclose(fi);
  1970. X    }
  1971. X    }
  1972. X
  1973. X    /*
  1974. X     *    Couldn't find nothing, use DefaultNode
  1975. X     */
  1976. X
  1977. X    if (level == 0) {
  1978. X    ulog(-1, "Warning, unable to interpret addr %s, using DefaultNode", name);
  1979. X    if (DefaultNode == NULL) {
  1980. X        ulog(-1, "Error, DefaultNode must exist if no UULIB:Domain");
  1981. X        printf("ERROR, no entry in UULIB:Domain, UULIB:L.sys, and\n");
  1982. X        printf("no DefaultNode config entry for %s\n", name);
  1983. X        puts("cannot send mail");
  1984. X        free(tbase);
  1985. X        return(0);
  1986. X    }
  1987. X    strcpy(tb, "MF");
  1988. X    strcpy(cb, "UU");
  1989. X    strcpy(ab, DefaultNode);
  1990. X    level = 1;
  1991. X    }
  1992. X    free(tbase);
  1993. X    return(level > 0);
  1994. X}
  1995. X
  1996. X/*
  1997. X *  Compares a broken up address with a domain entry (buf).
  1998. X */
  1999. X
  2000. XCompareDomain(da1, di1, da2, di2)
  2001. Xchar **da1;
  2002. Xshort di1;
  2003. Xchar **da2;
  2004. Xshort di2;
  2005. X{
  2006. X    short i, j;
  2007. X    short level = 0;
  2008. X
  2009. X    for (i = di1 - 1, j = di2 - 1; i >= 0 && j >= 0; --i, --j) {
  2010. X    if (da2[j][0] == '*') {
  2011. X        ++level;
  2012. X        if (i && j == 0)    /*  so loop does not terminate  */
  2013. X        ++j;
  2014. X        continue;
  2015. X    }
  2016. X    if (strcmpi(da1[i], da2[j]) == 0)
  2017. X        level += 2;
  2018. X    else {
  2019. X        if (j + 1 < di2 && da2[j+1][0] == '*') {
  2020. X        ++level;
  2021. X        ++j;
  2022. X        } else
  2023. X        return(0);
  2024. X    }
  2025. X    }
  2026. X    if (j >= 0)         /*  didn't exhaust domain entry */
  2027. X    return(0);
  2028. X    return((int)level);
  2029. X}
  2030. X
  2031. END_OF_FILE
  2032. if test 4164 -ne `wc -c <'src/sendmail/domain.c'`; then
  2033.     echo shar: \"'src/sendmail/domain.c'\" unpacked with wrong size!
  2034. fi
  2035. # end of 'src/sendmail/domain.c'
  2036. fi
  2037. if test -f 'src/uucico/modem.c' -a "${1}" != "-c" ; then 
  2038.   echo shar: Will not clobber existing file \"'src/uucico/modem.c'\"
  2039. else
  2040. echo shar: Extracting \"'src/uucico/modem.c'\" \(3471 characters\)
  2041. sed "s/^X//" >'src/uucico/modem.c' <<'END_OF_FILE'
  2042. X
  2043. X/*
  2044. X *  MODEM.C
  2045. X *
  2046. X *  (C) Copyright 1989-1990 by Matthew Dillon,  All Rights Reserved.
  2047. X *
  2048. X */
  2049. X
  2050. X#include "includes.h"
  2051. X#include "uucp.h"
  2052. X#include "sysdep.h"
  2053. X#include "modem.h"
  2054. X#include "log.h"
  2055. X
  2056. X/*
  2057. X *  NOTE:   modem stuff pretty much ignored if we are run from
  2058. X *        a getty.
  2059. X */
  2060. X
  2061. X#define MULTIMODEM    /*  I have a multi-modem    */
  2062. X
  2063. Xextern int Getty;
  2064. Xextern int IgnoreCD;
  2065. X
  2066. Xint twrite();
  2067. Xint instr();
  2068. X
  2069. Xvoid set_baud();
  2070. X
  2071. Xvoid
  2072. Xopenline()
  2073. X{
  2074. X    signal(SIGINT,sigint);
  2075. X    IgnoreCD |= 4;
  2076. Xstart_again:
  2077. X    chkabort();
  2078. X    if (instr("CONNECT", 7))
  2079. X    goto start_again;
  2080. X
  2081. X
  2082. X#ifdef MULTIMODEM
  2083. X
  2084. X#else
  2085. X    set_baud(get_baud());
  2086. X#endif
  2087. X    Delay(120); /* sleep 2 seconds */
  2088. X
  2089. X    IgnoreCD &= ~4;
  2090. X}
  2091. X
  2092. X#ifndef MULTIMODEM
  2093. X
  2094. Xint
  2095. Xget_baud()
  2096. X{
  2097. X/* We've seen the CONNECT message, now we must see what baud rate
  2098. X   we've connected with */
  2099. X/* gather input until \r then see if it's 300, 1200, or 2400 */
  2100. X/* this is for hayes compatibles */
  2101. X
  2102. X    int data;
  2103. X    char rate[10];
  2104. X    int rate_inx = 0;
  2105. X
  2106. X    DEBUG(2,"looking for baud rate\n",0);
  2107. X
  2108. X    while ( ((data = xgetc(BYTE_TO)) != EOF) && ((char)data != '\r')) {
  2109. X        if ((char)data == ' ') continue;
  2110. X        rate[rate_inx++] = (char)data;
  2111. X    }
  2112. X    DEBUG(2, "found baud rate of %s\n", rate);
  2113. X    if (strncmp(rate,"1200",4) == 0) return 1200;
  2114. X    if (strncmp(rate,"2400",4) == 0) return 2400;
  2115. X    if (rate_inx == 0) return 300;
  2116. X    return 1200;  /* default */
  2117. X}
  2118. X
  2119. X#endif
  2120. X
  2121. Xvoid
  2122. Xmodem_init()
  2123. X{
  2124. X    reset_modem();
  2125. X}
  2126. X
  2127. X/*
  2128. X * Simple dialer routine.  Needs replacement with a full blown
  2129. X * script driven dialer.  Next week maybe :-).    FIXME.
  2130. X */
  2131. X
  2132. Xint
  2133. Xdial_nbr(nbr)
  2134. Xchar  *nbr;
  2135. X{
  2136. X    char  dial[30];
  2137. X    int   i;
  2138. X
  2139. X    IgnoreCD |= 4;
  2140. X
  2141. X    sprintf(dial, "%s%s\r", "ATDT", nbr);
  2142. X
  2143. X    DEBUG(2,"dialing %s\n", dial);
  2144. X
  2145. X    twrite(dial, strlen(dial));
  2146. X
  2147. X    i = instr("CONNECT", 7);
  2148. X
  2149. X    if (i == 0)     /*  for those modems which don't bring CD up */
  2150. X    Delay(50);  /*  immediately                              */
  2151. X
  2152. X    IgnoreCD &= ~4;
  2153. X
  2154. X    return (i);
  2155. X}
  2156. X
  2157. X/*
  2158. X *  RESET_MODEM()
  2159. X *
  2160. X *  If run from a Getty we do NOT reset the modem, which would
  2161. X *  disconnect an already connected connection.
  2162. X *
  2163. X *  Note that the delay between CloseSerial() and OpenSerial() only
  2164. X *  serves to give the Getty, if running, time to lock the port and
  2165. X *  begin a disconnect sequence.
  2166. X */
  2167. X
  2168. Xvoid
  2169. Xreset_modem()
  2170. X{
  2171. X    if (Getty)          /*  called from a getty             */
  2172. X    return;
  2173. X    DEBUG(4, "Beg-Reset\n", 0);
  2174. X    CloseSerial();      /*  drop dtr            */
  2175. X    Delay(50*3);        /*  delay 3 seconds     */
  2176. X    DEBUG(4, "End-Reset-1\n", 0);
  2177. X    OpenSerial();       /*  re-open serial      */
  2178. X    DEBUG(4, "End-Reset-2\n", 0);
  2179. X}
  2180. X
  2181. X#ifdef NOTDEF
  2182. X
  2183. X    if (GettyCmd(DeviceName, DeviceUnit, '0', NULL) == 0)
  2184. X    return;
  2185. X
  2186. X    /*
  2187. X     *    Getty doesn't exist, we have to reset the modem ourselves!
  2188. X     */
  2189. X
  2190. X    IgnoreCD |= 4;
  2191. X
  2192. X#ifdef MULTIMODEM
  2193. X    set_baud(19200);
  2194. X
  2195. X    if (CheckCarrier()) {
  2196. X    Delay(60);
  2197. X    twrite("+++", 3);
  2198. X    Delay(120);
  2199. X    }
  2200. X    twrite("ATH0\r", 5);
  2201. X    instr("OK\r\n", 4);
  2202. X    twrite("ATZ\r", 4);
  2203. X    instr("OK\r\n", 4);
  2204. X    twrite("ATZ\r", 4);
  2205. X    instr("OK\r\n", 4);
  2206. X
  2207. X    /*amiga_closeopen();*/
  2208. X    sprintf(init, "%s\r", "ATM0S0=2X4$BA0");
  2209. X    if (debug > 0)
  2210. X    init[3] = '1';
  2211. X    twrite(init, strlen(init));
  2212. X    instr("OK\r\n",4);
  2213. X#else
  2214. X    twrite("+++", 3);
  2215. X    Delay(60);
  2216. X    twrite("ATH0\r", 5);
  2217. X    Delay(120);
  2218. X    twrite("ATZ\r", 4);
  2219. X    Delay(60);
  2220. X    twrite("ATZ\r", 4);
  2221. X    Delay(60);
  2222. X    sprintf(init, "%s\r", "ATS2");
  2223. X    twrite(init, strlen(init));
  2224. X    Delay(60);
  2225. X#endif
  2226. X    IgnoreCD &= ~4;
  2227. X}
  2228. X
  2229. X#endif
  2230. X
  2231. END_OF_FILE
  2232. if test 3471 -ne `wc -c <'src/uucico/modem.c'`; then
  2233.     echo shar: \"'src/uucico/modem.c'\" unpacked with wrong size!
  2234. fi
  2235. # end of 'src/uucico/modem.c'
  2236. fi
  2237. if test -f 'src/uucico/uucp.c' -a "${1}" != "-c" ; then 
  2238.   echo shar: Will not clobber existing file \"'src/uucico/uucp.c'\"
  2239. else
  2240. echo shar: Extracting \"'src/uucico/uucp.c'\" \(3907 characters\)
  2241. sed "s/^X//" >'src/uucico/uucp.c' <<'END_OF_FILE'
  2242. X
  2243. X/*
  2244. X *   UUCP.c written by William Loftus
  2245. X *   Copyright 1988 by William Loftus.    All rights reserved.
  2246. X */
  2247. X
  2248. X#include <stdio.h>
  2249. X#include "/version.h"
  2250. X
  2251. XIDENT(".00");
  2252. X
  2253. Xchar to_buf[128];
  2254. Xchar from_buf[128];
  2255. Xchar path[128];
  2256. Xchar user[8];
  2257. X
  2258. Xchar command_file[128];
  2259. Xint seq;
  2260. X
  2261. Xvoid BuildReceiveFile();
  2262. Xvoid BuildSendFile();
  2263. Xvoid read_ctl();
  2264. Xchar *expand_file();
  2265. Xchar *strchr();
  2266. Xchar *getcwd();
  2267. X
  2268. X#define TRUE 1
  2269. X#define FALSE 0
  2270. X
  2271. XCXBRK()
  2272. X{
  2273. X    return(0);
  2274. X}
  2275. X
  2276. Xvoid
  2277. Xmain(argc,argv)
  2278. Xint argc;
  2279. Xchar **argv;
  2280. X{
  2281. X    int to_bang, from_bang;
  2282. X
  2283. X    if (argc != 3) {
  2284. X    printf("Usage: UUCP from_file to_file\n");
  2285. X    exit(1);
  2286. X    } else {
  2287. X    strcat(from_buf, argv[1]);
  2288. X    strcat(to_buf, argv[2]);
  2289. X    }
  2290. X
  2291. X    getcwd(path,128);
  2292. X
  2293. X    if (chdir("UUSPOOL:")) {
  2294. X    printf("Couldn't change current working directory to UUSPOOL:\n");
  2295. X    exit(1);
  2296. X    }
  2297. X
  2298. X    read_ctl();
  2299. X
  2300. X    seq = GetSequence(2);
  2301. X    if (seq < 0) {
  2302. X    chdir(path);
  2303. X    exit(1);
  2304. X    }
  2305. X
  2306. X    from_bang = (int)strchr(from_buf,'!');
  2307. X    to_bang = (int)strchr(to_buf,'!');
  2308. X
  2309. X    if (from_bang && to_bang) {
  2310. X    printf("Can not specify a remote system in both arguments.\n");
  2311. X    chdir(path);
  2312. X    exit(1);
  2313. X    }
  2314. X
  2315. X    if (from_bang) {
  2316. X    BuildReceiveFile();
  2317. X    }
  2318. X
  2319. X    if (to_bang) {
  2320. X    BuildSendFile();
  2321. X    }
  2322. X
  2323. X    chdir(path);
  2324. X    exit(0);
  2325. X}
  2326. X
  2327. Xvoid
  2328. XBuildSendFile()
  2329. X{
  2330. X    FILE *fp;
  2331. X    char system_name[32];
  2332. X    int bang;
  2333. X
  2334. X    strcpy(from_buf,expand_file(from_buf));
  2335. X
  2336. X    bang = (int)strchr(to_buf,'!');
  2337. X    bang = bang - (int)to_buf;
  2338. X
  2339. X    strncpy(system_name,to_buf,bang);
  2340. X
  2341. X    system_name[bang] = '\0';
  2342. X
  2343. X    if (!is_in_L_sys_file(system_name)) {
  2344. X    printf("System \"%s\" not in L.sys file.\n", system_name);
  2345. X    chdir(path);
  2346. X    exit(1);
  2347. X    }
  2348. X
  2349. X    system_name[7] = '\0';
  2350. X
  2351. X    sprintf(command_file,"C.%sA%04d", system_name, seq++);
  2352. X
  2353. X    LockFile(command_file);
  2354. X
  2355. X    fp = fopen(command_file,"w");
  2356. X
  2357. X    if (fp) {
  2358. X    /* srcnam desnam who flags temp mode who */
  2359. X    fprintf(fp,"S %s %s %s %s %s %s %s\n",
  2360. X        from_buf,
  2361. X        to_buf + bang + 1,
  2362. X        user,
  2363. X        "-c",
  2364. X        from_buf,
  2365. X        "0666",
  2366. X        user
  2367. X    );
  2368. X    fclose(fp);
  2369. X    } else {
  2370. X    UnLockFile(command_file);
  2371. X    perror(command_file);
  2372. X    chdir(path);
  2373. X    exit(1);
  2374. X    }
  2375. X    UnLockFile(command_file);
  2376. X    printf("Command queue for transfer to %s.\n", system_name);
  2377. X}
  2378. X
  2379. Xvoid
  2380. XBuildReceiveFile()
  2381. X{
  2382. X    FILE *fp;
  2383. X    char system_name[32];
  2384. X    int bang;
  2385. X
  2386. X    strcpy(to_buf,expand_file(to_buf));
  2387. X
  2388. X    bang = (int)strchr(from_buf,'!');
  2389. X    bang = bang - (int)from_buf;
  2390. X
  2391. X    strncpy(system_name,from_buf,bang);
  2392. X
  2393. X    system_name[bang] = '\0';
  2394. X
  2395. X    if (!is_in_L_sys_file(system_name)) {
  2396. X    printf("System \"%s\" not in L.sys file.\n", system_name);
  2397. X    chdir(path);
  2398. X    exit(1);
  2399. X    }
  2400. X
  2401. X    system_name[7] = '\0';
  2402. X
  2403. X    sprintf(command_file,"C.%sA%04d", system_name, seq++);
  2404. X
  2405. X    LockFile(command_file);
  2406. X
  2407. X    fp = fopen(command_file,"w");
  2408. X    if (fp) {
  2409. X    /* srcnam desnam who flags */
  2410. X    fprintf(fp,"R %s %s %s %s\n",
  2411. X        from_buf + bang + 1,
  2412. X        to_buf,
  2413. X        user,
  2414. X        "-c"
  2415. X    );
  2416. X    fclose(fp);
  2417. X    } else {
  2418. X    UnLockFile(command_file);
  2419. X    perror(command_file);
  2420. X    chdir(path);
  2421. X    exit(1);
  2422. X    }
  2423. X    UnLockFile(command_file);
  2424. X    printf("Command queue for transfer from %s.\n", system_name);
  2425. X}
  2426. X
  2427. Xstatic char name[128];
  2428. X
  2429. Xchar *
  2430. Xexpand_file(file_name)
  2431. Xchar *file_name;
  2432. X{
  2433. X    char *colon;
  2434. X
  2435. X    colon = strchr(file_name,':');
  2436. X    if ((colon != (char*)NULL) && (colon != file_name)) {
  2437. X    return(file_name);
  2438. X    } else {
  2439. X    if (path[strlen(path)-1] != ':') {
  2440. X        sprintf(name,"%s/%s",path,file_name);
  2441. X        return name;
  2442. X    } else {
  2443. X        sprintf(name,"%s%s",path,file_name);
  2444. X        return name;
  2445. X    }
  2446. X    }
  2447. X}
  2448. X
  2449. X#define CTL_DELIM " \t\r\n"
  2450. X
  2451. X/*
  2452. X * Read the control file and grab a few parameters.
  2453. X */
  2454. X
  2455. Xvoid
  2456. Xread_ctl()
  2457. X{
  2458. X    FILE  *fd;
  2459. X    static char  buf[128];
  2460. X
  2461. X    if (! (fd = fopen("UULIB:Config", "r"))) {
  2462. X    printf("Can't Find config file.\n");
  2463. X    chdir(path);
  2464. X    exit(3);
  2465. X    }
  2466. X
  2467. X    while (NULL != fgets(buf, sizeof buf, fd)) {
  2468. X    if (strncmp(buf, "UserName", 8) == 0)
  2469. X        strcpy(user, strtok(&buf[9], CTL_DELIM) ) ;
  2470. X    }
  2471. X    fclose(fd);
  2472. X}
  2473. X
  2474. X
  2475. END_OF_FILE
  2476. if test 3907 -ne `wc -c <'src/uucico/uucp.c'`; then
  2477.     echo shar: \"'src/uucico/uucp.c'\" unpacked with wrong size!
  2478. fi
  2479. # end of 'src/uucico/uucp.c'
  2480. fi
  2481. if test -f 'src/uucico/uux.c' -a "${1}" != "-c" ; then 
  2482.   echo shar: Will not clobber existing file \"'src/uucico/uux.c'\"
  2483. else
  2484. echo shar: Extracting \"'src/uucico/uux.c'\" \(3441 characters\)
  2485. sed "s/^X//" >'src/uucico/uux.c' <<'END_OF_FILE'
  2486. X
  2487. X/*
  2488. X *  UUX.C by William Loftus
  2489. X *  Copyright 1988 by William Loftus.    All rights reserved.
  2490. X *
  2491. X *  Example: 1> uux mail-message "burdvax!rmail wpl"
  2492. X */
  2493. X
  2494. X#include <stdio.h>
  2495. X#include <string.h>
  2496. X#include "/version.h"
  2497. X
  2498. XIDENT(".01");
  2499. X
  2500. Xchar user[128];
  2501. Xchar file_name[128];
  2502. Xchar command[128];
  2503. X
  2504. Xchar exec_file[128];
  2505. Xchar x_exec_file[128];
  2506. Xchar command_file[128];
  2507. Xchar data_file[128];
  2508. Xint seq;
  2509. X
  2510. Xchar path[128];
  2511. X
  2512. Xvoid read_ctl();
  2513. Xvoid GetTo();
  2514. Xvoid GetSubject();
  2515. X
  2516. X#define TRUE 1
  2517. X#define FALSE 0
  2518. X
  2519. XCXBRK()
  2520. X{
  2521. X    return(0);
  2522. X}
  2523. X
  2524. Xvoid
  2525. Xmain(argc, argv)
  2526. Xint argc;
  2527. Xchar **argv;
  2528. X{
  2529. X    int error;
  2530. X
  2531. X    getcwd(path,128);
  2532. X    chdir("UUSPOOL:");
  2533. X    read_ctl();
  2534. X    if (argc == 3) {
  2535. X    strcpy(file_name, argv[1]);
  2536. X    strcpy(command, argv[2]);
  2537. X    } else {
  2538. X    printf("Usage: uux file-name command\n");
  2539. X    printf("Example: 1> uux mail-message \"burdvax!rmail wpl\"\n");
  2540. X    chdir(path);
  2541. X    exit(1);
  2542. X    }
  2543. X    seq = GetSequence(4);
  2544. X    if (seq >= 0)
  2545. X    error = Queue();
  2546. X    UnLockFile(exec_file);
  2547. X    UnLockFile(x_exec_file);
  2548. X    UnLockFile(command_file);
  2549. X    UnLockFile(data_file);
  2550. X    chdir(path);
  2551. X    if (seq < 0 || error < 0)
  2552. X    exit(1);
  2553. X}
  2554. X
  2555. XQueue()
  2556. X{
  2557. X    FILE *fp;
  2558. X    char system_name[32];
  2559. X    int bang;
  2560. X    int error;
  2561. X
  2562. X    bang = (int)strchr(command,'!');
  2563. X    bang = bang - (int)command;
  2564. X
  2565. X    strncpy(system_name,command,bang);
  2566. X
  2567. X    system_name[bang] = '\0';
  2568. X
  2569. X    if (!is_in_L_sys_file(system_name)) {
  2570. X    printf ("System \"%s\" not in L.sys file.\n", system_name);
  2571. X    return(-1);
  2572. X    }
  2573. X
  2574. X    system_name[7] = '\0';
  2575. X
  2576. X    sprintf(exec_file,"D.%sX%04d", system_name, seq++);
  2577. X    sprintf(x_exec_file,"X.%sX%04d", system_name, seq++);
  2578. X    sprintf(command_file,"C.%sA%04d", system_name, seq++);
  2579. X    sprintf(data_file,"D.%sB%04d", system_name, seq);
  2580. X
  2581. X    LockFile(exec_file);
  2582. X    LockFile(x_exec_file);
  2583. X    LockFile(command_file);
  2584. X    LockFile(data_file);
  2585. X
  2586. X    fp = fopen(exec_file,"w");
  2587. X    if (fp) {
  2588. X    fprintf(fp,"U %s\n", user);
  2589. X    fprintf(fp,"F %s\n", data_file);
  2590. X    fprintf(fp,"I %s\n", data_file);
  2591. X    fprintf(fp,"C %s\n", (char *)command + bang + 1);
  2592. X    fclose(fp);
  2593. X    } else {
  2594. X    perror(exec_file);
  2595. X    return(-1);
  2596. X    }
  2597. X
  2598. X    fp = fopen(command_file,"w");
  2599. X    if (fp) {
  2600. X    fprintf(fp,"S %s %s %s - %s 0666\n",
  2601. X        data_file,
  2602. X        data_file,
  2603. X        user,
  2604. X        data_file
  2605. X    );
  2606. X    fprintf(fp,"S %s %s %s - %s 0666\n",
  2607. X        exec_file,
  2608. X        x_exec_file,
  2609. X        user,
  2610. X        exec_file
  2611. X    );
  2612. X    fclose(fp);
  2613. X    } else {
  2614. X    perror(command_file);
  2615. X    return(-1);
  2616. X    }
  2617. X    chdir(path);
  2618. X    error =  Copy(file_name, data_file);
  2619. X    chdir("UUSPOOL:");
  2620. X    return(error);
  2621. X}
  2622. X
  2623. X/*
  2624. X * Read the control file and grab a few parameters.
  2625. X */
  2626. X
  2627. X#define CTL_DELIM " \t\n\r"
  2628. X
  2629. Xvoid
  2630. Xread_ctl()
  2631. X{
  2632. X    FILE  *fd;
  2633. X    static char  buf[128];
  2634. X
  2635. X    if (! (fd = fopen("UULIB:config", "r"))) {
  2636. X    printf("Can't Find config file");
  2637. X    perror("config");
  2638. X    chdir(path);
  2639. X    exit(3);
  2640. X    }
  2641. X
  2642. X    while (NULL != fgets(buf, sizeof buf, fd)) {
  2643. X    if (strncmp(buf, "UserName", 8) == 0)
  2644. X        strcpy(user, strtok(&buf[9], CTL_DELIM));
  2645. X    }
  2646. X    fclose(fd);
  2647. X}
  2648. X
  2649. XCopy(from, to)
  2650. Xchar *from;
  2651. Xchar *to;
  2652. X{
  2653. X    FILE *fd;
  2654. X    FILE *td;
  2655. X    int c;
  2656. X    static char to_buf[128];
  2657. X
  2658. X    fd = fopen(from, "r");
  2659. X    if (!fd) {
  2660. X    printf("Could not open %s.\n", from);
  2661. X    perror(from);
  2662. X    return(-1);
  2663. X    }
  2664. X
  2665. X    strcpy(to_buf, "UUSPOOL:");
  2666. X    strcat(to_buf, to);
  2667. X
  2668. X    td = fopen(to_buf, "w");
  2669. X    if (!td) {
  2670. X    printf("Could not open %s.\n", to_buf);
  2671. X    perror(to);
  2672. X    return(-1);
  2673. X    }
  2674. X    while ((c = fgetc(fd)) != EOF) {
  2675. X    fputc((char)c, td);
  2676. X    }
  2677. X    fclose(fd);
  2678. X    fclose(td);
  2679. X    return(1);
  2680. X}
  2681. X
  2682. X
  2683. END_OF_FILE
  2684. if test 3441 -ne `wc -c <'src/uucico/uux.c'`; then
  2685.     echo shar: \"'src/uucico/uux.c'\" unpacked with wrong size!
  2686. fi
  2687. # end of 'src/uucico/uux.c'
  2688. fi
  2689. echo shar: End of archive 4 \(of 16\).
  2690. cp /dev/null ark4isdone
  2691. MISSING=""
  2692. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ; do
  2693.     if test ! -f ark${I}isdone ; then
  2694.     MISSING="${MISSING} ${I}"
  2695.     fi
  2696. done
  2697. if test "${MISSING}" = "" ; then
  2698.     echo You have unpacked all 16 archives.
  2699.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  2700. else
  2701.     echo You still need to unpack the following archives:
  2702.     echo "        " ${MISSING}
  2703. fi
  2704. ##  End of shell archive.
  2705. exit 0
  2706. -- 
  2707. Submissions to comp.sources.amiga and comp.binaries.amiga should be sent to:
  2708.     amiga@cs.odu.edu    
  2709. or    amiga@xanth.cs.odu.edu    ( obsolescent mailers may need this address )
  2710. or    ...!uunet!xanth!amiga    ( very obsolescent mailers need this address )
  2711.  
  2712. Comments, questions, and suggestions should be addressed to ``amiga-request''
  2713. (please only use ``amiga'' for actual submissions) at the above addresses.
  2714.